From 5230a8e0a06a5d67d6c13f2359bc51be07b4fb5a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 9 Sep 2016 00:41:57 +0200 Subject: Shortcut menu: menu is now dynamic - selected items filter dependant items (refs #2996) - can now pin items from sheet (refs #3078) --- archaeological_operations/models.py | 8 ++++++-- archaeological_operations/templates/ishtar/sheet_operation.html | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index f5a1ca8b0..701ae4593 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -174,6 +174,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, 'start_date', 'excavation_end_date'] TABLE_COLS.insert(4, 'associated_file_short_label') IMAGE_PREFIX = 'operations/' + SLUG = 'operation' creation_date = models.DateField(_(u"Creation date"), default=datetime.date.today) end_date = models.DateField(_(u"Closing date"), null=True, blank=True) @@ -298,8 +299,11 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, ordering = ('cached_label',) @classmethod - def get_owns(cls, user): - owns = super(Operation, cls).get_owns(user) + def get_owns(cls, user, menu_filtr=None): + extra_query = {} + if menu_filtr: + extra_query = {'associated_file': menu_filtr} + owns = super(Operation, cls).get_owns(user, extra_query=extra_query) # owns = owns.annotate(null_count=Count('operation_code')) # return owns.order_by("common_name", "-year", "operation_code") return sorted(owns, key=lambda x: x.cached_label) diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 2f6dbdf4c..6b2030f5e 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -4,7 +4,7 @@ {% block head_title %}{% trans "Operation" %}{% endblock %} {% block content %} -{% window_nav item window_id 'show-operation' 'operation_modify' 'show-historized-operation' 'revert-operation' previous next %} +{% window_nav item window_id 'show-operation' 'operation_modify' 'show-historized-operation' 'revert-operation' previous next 1 %} {% if item.image %} -- cgit v1.2.3