class City models Model parent models ForeignKey self verbose_name Род

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
class City(models.Model):
parent = models.ForeignKey("self", verbose_name="Родитель")
country = models.CharField(verbose_name="Страна", max_length=50)
region = models.CharField(verbose_name="Область", max_length=50, blank=True, null=False)
area = models.CharField(verbose_name="Район", max_length=50, blank=True, null=False)
city = models.CharField(verbose_name="Город", max_length=50, blank=True, null=False)
district = models.CharField(verbose_name="Район города", max_length=50, blank=True, null=False)
street = models.CharField(verbose_name="Улица", max_length=50, blank=True, null=False)
lft = models.PositiveIntegerField(editable=False, blank=True, null=True)
rght = models.PositiveIntegerField(editable=False, blank=True, null=True)
tree_id = models.PositiveIntegerField(editable=False, blank=True, null=True)
level = models.PositiveIntegerField(editable=False, blank=True, null=True)