summaryrefslogtreecommitdiff
path: root/archaeological_finds/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-11-30 13:20:53 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-11-30 13:20:53 +0100
commit8b666443667f92e014d70a4247c7885375bba610 (patch)
tree7e216f7c036ae568407d46359dea361f2a641098 /archaeological_finds/models.py
parent62cac0ec03a96d5f358148cf6dff2a21ccf20854 (diff)
downloadIshtar-8b666443667f92e014d70a4247c7885375bba610.tar.bz2
Ishtar-8b666443667f92e014d70a4247c7885375bba610.zip
Simple treatment form. Treatment listing. (refs #3365)
Diffstat (limited to 'archaeological_finds/models.py')
-rw-r--r--archaeological_finds/models.py15
1 files changed, 12 insertions, 3 deletions
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