diff options
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): |