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 | 601b5ef0a53ff697890dcd0c26396aa664e35ad7 (patch) | |
tree | df039068c6530250f1bcb2d147b00feafcd2a285 /ishtar_common/models.py | |
parent | ea90451f788dcfa90426fa55f558507fa3d67fbb (diff) | |
download | Ishtar-601b5ef0a53ff697890dcd0c26396aa664e35ad7.tar.bz2 Ishtar-601b5ef0a53ff697890dcd0c26396aa664e35ad7.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) |