blob: 98cfb9b8f7dcd33033805e9e083c2fe0fff2b042 [file] [log] [blame]
Siobhan Tully4bc09f22013-04-10 21:15:21 -04001import os
2from django.db import models
Siobhan Tully30fd4292013-05-10 08:59:56 -04003from core.models import PlCoreBase
Siobhan Tully4bc09f22013-04-10 21:15:21 -04004
5# Create your models here.
6
7class Key(PlCoreBase):
8 name = models.CharField(max_length=256, unique=True)
Siobhan Tully30fd4292013-05-10 08:59:56 -04009 nkey_id = models.CharField(max_length=256, unique=True)
Siobhan Tully4bc09f22013-04-10 21:15:21 -040010 key = models.CharField(max_length=512)
11 type = models.CharField(max_length=256)
12 blacklisted = models.BooleanField(default=False)
Siobhan Tully4bc09f22013-04-10 21:15:21 -040013
14 def __unicode__(self): return u'%s' % (self.name)
Tony Mack759b57a2013-04-14 21:03:31 -040015
16 def save(self, *args, **kwds):
Tony Mackd685bfa2013-05-02 10:09:51 -040017 self.os_manager.save_key(self)
Tony Mack759b57a2013-04-14 21:03:31 -040018 super(Key, self).save(*args, **kwds)
19
20 def delete(self, *args, **kwds):
Tony Mackd685bfa2013-05-02 10:09:51 -040021 self.os_manager.delete_key(self)
Tony Mack759b57a2013-04-14 21:03:31 -040022 super(Key, self).delete(*args, **kwds)
23