class Cities models Model parent models ForeignKey self verbose_name Р

1
2
3
4
5
6
7
8
class Cities(models.Model):
parent = models.ForeignKey("self", verbose_name="Родитель", related_name='child_set', blank=True, null=True)
location_name = models.CharField(verbose_name="Название местности", max_length=50)
is_center = models.BooleanField(verbose_name="Является районным центром", blank=True, null=True)
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)