Move keuy model up to top, add foreignkey to bindserver model to eventually use for transfer keys

This commit is contained in:
Jeffrey Forman 2012-11-08 23:00:31 -05:00
parent 55a99dd7f2
commit 5154dd4298
1 changed files with 10 additions and 8 deletions

View File

@ -8,10 +8,19 @@ import urllib2
TSIG_ALGORITHMS = (('hmac-md5', 'MD5'),('hmac-sha1', 'SHA1'),('hmac-224', 'SHA224'),('hmac-sha256', 'SHA256'),('hmac-sha384', 'SHA384'),('hmac-sha512', 'SHA512')) TSIG_ALGORITHMS = (('hmac-md5', 'MD5'),('hmac-sha1', 'SHA1'),('hmac-224', 'SHA224'),('hmac-sha256', 'SHA256'),('hmac-sha384', 'SHA384'),('hmac-sha512', 'SHA512'))
class Key(models.Model):
name = models.CharField(max_length=50)
data = models.CharField(max_length=150)
algorithm = models.CharField(max_length=200, choices=TSIG_ALGORITHMS)
def __unicode__(self):
return self.name
class BindServer(models.Model): class BindServer(models.Model):
hostname = models.CharField(max_length=100) hostname = models.CharField(max_length=100)
statistics_port = models.IntegerField() statistics_port = models.IntegerField()
control_port = models.IntegerField() default_transfer_key = models.ForeignKey(Key,null=True,blank=True)
def __unicode__(self): def __unicode__(self):
return self.hostname return self.hostname
@ -60,10 +69,3 @@ class BindServer(models.Model):
'rr_data' : split_record.split(" ")[4]}) 'rr_data' : split_record.split(" ")[4]})
return record_array return record_array
class Key(models.Model):
name = models.CharField(max_length=50)
data = models.CharField(max_length=150)
algorithm = models.CharField(max_length=200, choices=TSIG_ALGORITHMS)
def __unicode__(self):
return self.name