diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-23 18:40:47 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:43:58 +0200 | 
| commit | 8279d1c668a54868e7195d20eb39d1ce4c5a1c06 (patch) | |
| tree | c595e4556ff333b80c51e161d6c539d9775cec94 /archaeological_warehouse/models.py | |
| parent | 349466995516bc0b5eb72f333693ac8dfb5146f2 (diff) | |
| download | Ishtar-8279d1c668a54868e7195d20eb39d1ce4c5a1c06.tar.bz2 Ishtar-8279d1c668a54868e7195d20eb39d1ce4c5a1c06.zip | |
Images: add a main_image field (refs #4076) - Add images associated to warehouses (refs #3879)
Diffstat (limited to 'archaeological_warehouse/models.py')
| -rw-r--r-- | archaeological_warehouse/models.py | 10 | 
1 files changed, 9 insertions, 1 deletions
| diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 035fc0c74..a860497e0 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 +    ImageModel, DashboardFormItem, IshtarImage  class WarehouseType(GeneralType): @@ -58,6 +58,8 @@ class Warehouse(Address, DashboardFormItem, OwnPerms):          'WarehouseDivision', verbose_name=_("Divisions"), blank=True,          through='WarehouseDivisionLink'      ) +    images = models.ManyToManyField(IshtarImage, verbose_name=_(u"Images"), +                                    through='WarehouseImage', blank=True)      external_id = models.TextField(_(u"External ID"), blank=True, null=True)      auto_external_id = models.BooleanField(          _(u"External ID is set automatically"), default=False) @@ -202,6 +204,12 @@ 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 Collection(LightHistorizedItem):      name = models.CharField(_(u"Name"), max_length=200,                              null=True, blank=True) | 
