summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_treatments.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-12-03 13:46:43 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-12-03 13:46:43 +0100
commit34c00b1877c274c84d03c9ed4c0a656f0c5b5ed3 (patch)
tree187d99571a172a9944be5855f0d5c325ee43e028 /archaeological_finds/models_treatments.py
parent3399828d16f12caecf6eed8acd2869d5f20f1817 (diff)
downloadIshtar-34c00b1877c274c84d03c9ed4c0a656f0c5b5ed3.tar.bz2
Ishtar-34c00b1877c274c84d03c9ed4c0a656f0c5b5ed3.zip
QA sheet: administrative act action
Diffstat (limited to 'archaeological_finds/models_treatments.py')
-rw-r--r--archaeological_finds/models_treatments.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index 15ef64040..080d2cc50 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -267,6 +267,17 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem,
upstream_lbl.short_description = _(u"Upstream finds")
upstream_lbl.admin_order_field = 'upstream__cached_label'
+ def get_extra_actions(self, request):
+ # url, base_text, icon, extra_text, extra css class, is a quick action
+ actions = []
+ if self.can_do(request, 'add_administrativeact'):
+ actions += [
+ (reverse('treatment-add-adminact', args=[self.pk]),
+ _(u"Add associated administrative act"), "fa fa-plus",
+ _(u"admin. act"), "", False),
+ ]
+ return actions
+
def get_values(self, prefix=''):
values = super(Treatment, self).get_values(prefix=prefix)
values[prefix + "upstream_finds"] = u" ; ".join(
@@ -843,13 +854,20 @@ class TreatmentFile(DashboardFormItem, ClosedItem, BaseHistorizedItem,
'name') if getattr(self, attr)])
def get_extra_actions(self, request):
+ # url, base_text, icon, extra_text, extra css class, is a quick action
+ actions = []
+ if self.can_do(request, 'add_administrativeact'):
+ actions += [
+ (reverse('treatmentfile-add-adminact', args=[self.pk]),
+ _(u"Add associated administrative act"), "fa fa-plus",
+ _(u"admin. act"), "", False),
+ ]
if not self.associated_basket:
- return []
+ return actions
if self.type.treatment_type and self.treatments.filter(
treatment_types__pk=self.type.treatment_type.pk).count():
# a treatment of this type already exists
- return []
- actions = []
+ return actions
can_edit_find = self.can_do(request, 'change_find')
if can_edit_find:
actions += [