From 8b666443667f92e014d70a4247c7885375bba610 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Nov 2016 13:20:53 +0100 Subject: Simple treatment form. Treatment listing. (refs #3365) --- archaeological_finds/models.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'archaeological_finds/models.py') diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index b7637ba3b..a886485b5 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -793,6 +793,7 @@ post_delete.connect(post_save_cache, sender=TreatmentType) class Treatment(BaseHistorizedItem, OwnPerms): + SHOW_URL = 'show-treatment' external_id = models.CharField(_(u"External ID"), blank=True, null=True, max_length=120) container = models.ForeignKey(Container, verbose_name=_(u"Container"), @@ -814,6 +815,16 @@ class Treatment(BaseHistorizedItem, OwnPerms): start_date = models.DateField(_(u"Start date"), blank=True, null=True) end_date = models.DateField(_(u"End date"), blank=True, null=True) history = HistoricalRecords() + TABLE_COLS = ('treatment_type__label', 'person', 'start_date', + 'downstream_cached_label', 'upstream_cached_label') + EXTRA_REQUEST_KEYS = { + "downstream_cached_label": "downstream__cached_label", + "upstream_cached_label": "upstream__cached_label", + } + TABLE_COLS_LBL = { + "downstream_cached_label": _(u"Downstream find"), + "upstream_cached_label": _(u"Upstream find"), + } class Meta: verbose_name = _(u"Treatment") @@ -844,10 +855,8 @@ class Treatment(BaseHistorizedItem, OwnPerms): super(Treatment, self).save(*args, **kwargs) if not is_new or not items: return - basket = None if hasattr(items, "items"): - basket = items - items = basket.items.all() + items = items.items.all() for item in items: new = item.duplicate(user) item.downstream_treatment = self -- cgit v1.2.3