From da4af2ab5d105f6d2ce442b517e532b7570616e3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 7 Apr 2017 10:47:39 +0200 Subject: Treatment - Treatment files dashboard: first overview (refs #3381) --- ishtar_common/views.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'ishtar_common/views.py') diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 4732313ea..e8a2c9e12 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1451,6 +1451,9 @@ def dashboard_main(request, dct, obj_id=None, *args, **kwargs): app_list.append((_(u"Context records"), 'contextrecords')) if profile.find: app_list.append((_(u"Finds"), 'finds')) + if profile.warehouse: + app_list.append((_(u"Treatment requests"), 'treatmentfiles')) + app_list.append((_(u"Treatments"), 'treatments')) dct = {'app_list': app_list} return render_to_response('ishtar/dashboards/dashboard_main.html', dct, context_instance=RequestContext(request)) @@ -1497,18 +1500,27 @@ def dashboard_main_detail(request, item_name): if item_name == 'files' and profile.files: lbl, dashboard = (_(u"Archaeological files"), models.Dashboard(File, **dashboard_kwargs)) - if item_name == 'operations': + elif item_name == 'operations': from archaeological_operations.models import Operation lbl, dashboard = (_(u"Operations"), models.Dashboard(Operation, **dashboard_kwargs)) - if item_name == 'contextrecords' and profile.context_record: + elif item_name == 'contextrecords' and profile.context_record: lbl, dashboard = ( _(u"Context records"), models.Dashboard(ContextRecord, slice=slicing, fltr=fltr)) - if item_name == 'finds' and profile.find: + elif item_name == 'finds' and profile.find: lbl, dashboard = (_(u"Finds"), models.Dashboard(Find, slice=slicing, fltr=fltr)) + elif item_name == 'treatmentfiles' and profile.warehouse: + lbl, dashboard = ( + _(u"Treatment requests"), + models.Dashboard(TreatmentFile, slice=slicing, fltr=fltr)) + elif item_name == 'treatments' and profile.warehouse: + lbl, dashboard = ( + _(u"Treatments"), + models.Dashboard(Treatment, slice=slicing, fltr=fltr, + date_source='start')) if not lbl: raise Http404 dct = {'lbl': lbl, 'dashboard': dashboard, -- cgit v1.2.3