from django.db import models

class Record(models.Model):
	domain_id = models.IntegerField()
	name = models.CharField(max_length=30)
	type=models.CharField(max_length=6)
	content=models.CharField(max_length=30)
	ttl=models.IntegerField()
	prio=models.IntegerField()
	change_date= models.IntegerField()
	def __unicode__(self):
        	return self.content
	def __unicode__(self):
        	return self.name
	class Meta:
		db_table = 'records'



from django.db import models

class Domain(models.Model):
    id = models.IntegerField(primary_key=True)
    name = models.CharField(unique=True, max_length=255)
    master = models.CharField(max_length=128)
    last_check = models.IntegerField()
    type = models.CharField(max_length=6)
    notified_serial = models.IntegerField()
    account = models.CharField(max_length=40)
    def __unicode__(self):
        return self.name
    class Meta:
        db_table = u'domains'

class Record(models.Model):                                                                                                                                 
    id = models.IntegerField(primary_key=True)                                                                                                               
    domain = models.ForeignKey(Domains)                                                                                                                      
    name = models.CharField(max_length=255)                                                                                                                  
    type = models.CharField(max_length=6)
    content = models.CharField(max_length=255)
    ttl = models.IntegerField()
    prio = models.IntegerField()
    change_date = models.IntegerField()
    def __unicode__(self):
        return self.name
    class Meta:
        db_table = u'records'

class Supermaster(models.Model):
    ip = models.CharField(max_length=25)
    nameserver = models.CharField(max_length=255)
    account = models.CharField(max_length=40)
    class Meta:
        db_table = u'supermasters'


Update model to match latest PDNS and add other two tables
Update model to match latest PDNS and add other two tables

  from django.db import models
  
- class Record(models.Model):
+ class Domain(models.Model):
- 	domain_id = models.IntegerField()
+     id = models.IntegerField(primary_key=True)
+     name = models.CharField(unique=True, max_length=255)
- 	name = models.CharField(max_length=30)
+     master = models.CharField(max_length=128)
+     last_check = models.IntegerField()
- 	type=models.CharField(max_length=6)
+     type = models.CharField(max_length=6)
+     notified_serial = models.IntegerField()
- 	content=models.CharField(max_length=30)
+     account = models.CharField(max_length=40)
- 	ttl=models.IntegerField()
- 	prio=models.IntegerField()
- 	change_date= models.IntegerField()
- 	def __unicode__(self):
+     def __unicode__(self):
-         	return self.content
- 	def __unicode__(self):
-         	return self.name
+         return self.name
- 	class Meta:
+     class Meta:
+         db_table = u'domains'
+ 
+ class Record(models.Model):                                                                                                                                 
+     id = models.IntegerField(primary_key=True)                                                                                                               
+     domain = models.ForeignKey(Domains)                                                                                                                      
+     name = models.CharField(max_length=255)                                                                                                                  
+     type = models.CharField(max_length=6)
+     content = models.CharField(max_length=255)
+     ttl = models.IntegerField()
+     prio = models.IntegerField()
+     change_date = models.IntegerField()
+     def __unicode__(self):
+         return self.name
+     class Meta:
- 		db_table = 'records'
+         db_table = u'records'
+ 
+ class Supermaster(models.Model):
+     ip = models.CharField(max_length=25)
+     nameserver = models.CharField(max_length=255)
+     account = models.CharField(max_length=40)
+     class Meta:
+         db_table = u'supermasters'
  
  
- 
Update model to match latest PDNS and add other two tables
## Code Before:
from django.db import models

class Record(models.Model):
	domain_id = models.IntegerField()
	name = models.CharField(max_length=30)
	type=models.CharField(max_length=6)
	content=models.CharField(max_length=30)
	ttl=models.IntegerField()
	prio=models.IntegerField()
	change_date= models.IntegerField()
	def __unicode__(self):
        	return self.content
	def __unicode__(self):
        	return self.name
	class Meta:
		db_table = 'records'



## Instruction:
Update model to match latest PDNS and add other two tables
## Code After:
from django.db import models

class Domain(models.Model):
    id = models.IntegerField(primary_key=True)
    name = models.CharField(unique=True, max_length=255)
    master = models.CharField(max_length=128)
    last_check = models.IntegerField()
    type = models.CharField(max_length=6)
    notified_serial = models.IntegerField()
    account = models.CharField(max_length=40)
    def __unicode__(self):
        return self.name
    class Meta:
        db_table = u'domains'

class Record(models.Model):                                                                                                                                 
    id = models.IntegerField(primary_key=True)                                                                                                               
    domain = models.ForeignKey(Domains)                                                                                                                      
    name = models.CharField(max_length=255)                                                                                                                  
    type = models.CharField(max_length=6)
    content = models.CharField(max_length=255)
    ttl = models.IntegerField()
    prio = models.IntegerField()
    change_date = models.IntegerField()
    def __unicode__(self):
        return self.name
    class Meta:
        db_table = u'records'

class Supermaster(models.Model):
    ip = models.CharField(max_length=25)
    nameserver = models.CharField(max_length=255)
    account = models.CharField(max_length=40)
    class Meta:
        db_table = u'supermasters'

