summaryrefslogtreecommitdiff
path: root/archaeological_finds/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models.py')
-rw-r--r--archaeological_finds/models.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
index 3e0d09ef8..a563a8404 100644
--- a/archaeological_finds/models.py
+++ b/archaeological_finds/models.py
@@ -794,6 +794,22 @@ post_delete.connect(post_save_cache, sender=TreatmentType)
class Treatment(BaseHistorizedItem, ImageModel, OwnPerms):
SHOW_URL = 'show-treatment'
+ TABLE_COLS = ('treatment_types_lbl', 'person', 'start_date',
+ 'downstream_cached_label', 'upstream_cached_label')
+ REVERSED_BOOL_FIELDS = ['image__isnull']
+ EXTRA_REQUEST_KEYS = {
+ "label": 'label__icontains',
+ "other_reference": 'other_reference__icontains',
+ "treatment_types": "treatment_types__pk",
+ "downstream_cached_label": "downstream__cached_label",
+ "upstream_cached_label": "upstream__cached_label",
+ 'image': 'image__isnull',
+ }
+ TABLE_COLS_LBL = {
+ "downstream_cached_label": _(u"Downstream find"),
+ "upstream_cached_label": _(u"Upstream find"),
+ }
+ IMAGE_PREFIX = 'treatment'
label = models.CharField(_(u"Label"), blank=True, null=True,
max_length=200)
other_reference = models.CharField(_(u"Other ref."), blank=True, null=True,
@@ -826,16 +842,6 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms):
blank=True, null=True)
target_is_basket = models.BooleanField(_("Target a basket"), default=False)
history = HistoricalRecords()
- TABLE_COLS = ('treatment_type', '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")
@@ -855,7 +861,7 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms):
lbl += u" %s %s" % (_(u"by"), unicode(self.person))
return lbl
- def treatment_type(self):
+ def treatment_types_lbl(self):
"""
Treatment types label
:return: string