diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-05-11 17:33:47 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:44:34 +0200 | 
| commit | cb2bdf1cf1ee85ddf68e93c29611024571961c5d (patch) | |
| tree | 9730565001c023b38104b04fafad2ec1ff183373 /archaeological_warehouse/models.py | |
| parent | 481279913a62416ce038b8eb82ad16b581fee7cf (diff) | |
| download | Ishtar-cb2bdf1cf1ee85ddf68e93c29611024571961c5d.tar.bz2 Ishtar-cb2bdf1cf1ee85ddf68e93c29611024571961c5d.zip | |
Adapt forms and wizards to manage M2M images (refs #4076)
Diffstat (limited to 'archaeological_warehouse/models.py')
| -rw-r--r-- | archaeological_warehouse/models.py | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 4edfe0d15..40de49d60 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -46,7 +46,12 @@ post_delete.connect(post_save_cache, sender=WarehouseType)  class Warehouse(Address, DashboardFormItem, OwnPerms): +    SLUG = 'warehouse'      SHOW_URL = 'show-warehouse' +    TABLE_COLS = ['name', 'warehouse_type'] +    BASE_SEARCH_VECTORS = ['name', 'warehouse_type__label', "external_id", +                           "town", "comment"] +      name = models.CharField(_(u"Name"), max_length=200)      warehouse_type = models.ForeignKey(WarehouseType,                                         verbose_name=_(u"Warehouse type")) @@ -64,10 +69,6 @@ class Warehouse(Address, DashboardFormItem, OwnPerms):      auto_external_id = models.BooleanField(          _(u"External ID is set automatically"), default=False) -    TABLE_COLS = ['name', 'warehouse_type'] -    BASE_SEARCH_VECTORS = ['name', 'warehouse_type__label', "external_id", -                           "town", "comment"] -      class Meta:          verbose_name = _(u"Warehouse")          verbose_name_plural = _(u"Warehouses") @@ -82,6 +83,9 @@ class Warehouse(Address, DashboardFormItem, OwnPerms):      def __unicode__(self):          return u"%s (%s)" % (self.name, unicode(self.warehouse_type)) +    def _get_base_image_path(self): +        return u"{}/{}".format(self.SLUG, slugify(self.name)) +      @property      def associated_filename(self):          return datetime.date.today().strftime('%Y-%m-%d') + '-' + \ | 
