diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-05-09 17:49:16 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:44:18 +0200 |
commit | 3f14d0f6481f1781d598d29b79a96fb7ee727320 (patch) | |
tree | 3c5fab3ad0c77f861ee46e18d14e7d6f848226af /ishtar_common | |
parent | 9a16cb47b06e22446e3593d8cc68186c0eac2093 (diff) | |
download | Ishtar-3f14d0f6481f1781d598d29b79a96fb7ee727320.tar.bz2 Ishtar-3f14d0f6481f1781d598d29b79a96fb7ee727320.zip |
Standardize related field item for imagee collections (refs #4076)
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 10 | ||||
-rw-r--r-- | ishtar_common/wizards.py | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 35be3ffc0..d4d6d2c79 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3065,6 +3065,16 @@ class IshtarImage(ImageModel): ordering = ('name',) +class ThroughImage(models.Model): + image = models.ForeignKey( + IshtarImage, on_delete=models.CASCADE) + is_main = models.BooleanField(_(u"Main image"), default=False) + + class Meta: + ordering = ('-is_main', 'image__name') + abstract = True + + if settings.COUNTRY == 'fr': class Arrondissement(models.Model): name = models.CharField(u"Nom", max_length=30) diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 2182e9060..f200447e4 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -789,6 +789,8 @@ class Wizard(NamedUrlWizardView): for old_item in old_m2ms[key]: is_ok = True for k in value: + if not hasattr(old_item, k): + continue if is_ok and getattr(old_item, k) != value[k]: is_ok = False continue |