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 | 43c017bc8dd00372f26728130b00b1cd9196fb10 (patch) | |
tree | 3c5fab3ad0c77f861ee46e18d14e7d6f848226af /archaeological_warehouse/models.py | |
parent | bf3810a26abe3c53fc11c4afe52e865cd5dbcc54 (diff) | |
download | Ishtar-43c017bc8dd00372f26728130b00b1cd9196fb10.tar.bz2 Ishtar-43c017bc8dd00372f26728130b00b1cd9196fb10.zip |
Standardize related field item for imagee collections (refs #4076)
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r-- | archaeological_warehouse/models.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index a860497e0..4edfe0d15 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -31,7 +31,7 @@ from ishtar_common.utils import cached_label_changed from ishtar_common.models import GeneralType, get_external_id, \ LightHistorizedItem, OwnPerms, Address, Person, post_save_cache, \ - ImageModel, DashboardFormItem, IshtarImage + ImageModel, DashboardFormItem, IshtarImage, ThroughImage class WarehouseType(GeneralType): @@ -204,10 +204,9 @@ class Warehouse(Address, DashboardFormItem, OwnPerms): return -class WarehouseImage(models.Model): - image = models.ForeignKey(IshtarImage, on_delete=models.CASCADE) - warehouse = models.ForeignKey(Warehouse, on_delete=models.CASCADE) - is_main = models.BooleanField(_(u"Main image"), default=False) +class WarehouseImage(ThroughImage): + item = models.ForeignKey(Warehouse, on_delete=models.CASCADE, + related_name='associated_images') class Collection(LightHistorizedItem): |