diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-18 17:52:48 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:41:54 +0200 |
commit | 48046732fbbd307906c492344c886da5f713f06d (patch) | |
tree | df039068c6530250f1bcb2d147b00feafcd2a285 /ishtar_common/models.py | |
parent | 4e6b1d4c2e4948d4269ff7c5734b94c15cb60a7e (diff) | |
download | Ishtar-48046732fbbd307906c492344c886da5f713f06d.tar.bz2 Ishtar-48046732fbbd307906c492344c886da5f713f06d.zip |
Manage groupment of towns with areas (refs #4060)
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 5d48dd813..1825335fd 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3130,6 +3130,19 @@ def town_child_changed(sender, **kwargs): m2m_changed.connect(town_child_changed, sender=Town.children.through) +class Area(HierarchicalType): + towns = models.ManyToManyField(Town, verbose_name=_(u"Towns"), blank=True) + parent = models.ForeignKey( + 'self', blank=True, null=True, verbose_name=_(u"Parent"), + help_text=_(u"Only four level of parent are managed.") + ) + + class Meta: + verbose_name = _(u"Area") + verbose_name_plural = _(u"Areas") + ordering = ('parent__label', 'label') + + class OperationType(GeneralType): order = models.IntegerField(_(u"Order"), default=1) preventive = models.BooleanField(_(u"Is preventive"), default=True) |