With these models, you can use your Django's database directly as backend for PowerDNS server (tested with MySQL).
License: GNU GPL.
More info: http://downloads.powerdns.com/documentation/html/configuring-db-connection.html#CONFIGURING-MYSQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | class Domain(models.Model):
name = models.CharField(max_length=255, unique=True, db_index=True)
type = models.CharField(max_length=6, db_index=True, choices=((x,x) for x in ('NATIVE', 'MASTER')))
notified_serial = models.PositiveIntegerField(null=True, blank=True, db_index=True)
master = models.CharField(max_length=128, null=True,blank=True, db_index=True)
last_check = models.PositiveIntegerField(null=True, blank=True, db_index=True)
account = models.CharField(max_length=40, null=True, blank=True, db_index=True)
class Meta:
db_table = 'domains'
ordering = ( 'name', 'type' )
def __unicode__(self):
return self.name
class Record(models.Model):
domain = models.ForeignKey('Domain')
name = models.CharField(max_length=255, db_index=True)
type = models.CharField(max_length=6, db_index=True, choices=((x,x) for x in ('A', 'CNAME', 'NS', 'PTR', 'SOA')))
content = models.CharField(max_length=255, db_index=True)
ttl = models.PositiveIntegerField(db_index=True)
prio = models.PositiveIntegerField(null=True, blank=True, db_index=True)
change_date = models.PositiveIntegerField(null=True, blank=True, db_index=True)
class Meta:
db_table = 'records'
ordering = ( 'name', 'type' )
unique_together = ( 'name', 'type', 'content' )
def __unicode__(self):
return self.name
class Supermaster(models.Model):
nameserver = models.CharField(max_length=255, db_index=True)
account = models.CharField(max_length=40, null=True, blank=True, db_index=True)
class Meta:
db_table = 'supermasters'
ordering = ( 'nameserver', 'account' )
unique_together = ( 'nameserver', 'account' )
def __unicode__(self):
return self.nameserver
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 8 months, 4 weeks ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 9 months ago
- Serializer factory with Django Rest Framework by julio 1 year, 3 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 4 months ago
- Help text hyperlinks by sa2812 1 year, 5 months ago
Comments
Please login first before commenting.