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_context_records/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'archaeological_context_records/models.py') diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index a98f7792a..fa2d5b430 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -108,6 +108,7 @@ class IdentificationType(GeneralType): class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): SHOW_URL = 'show-contextrecord' + SLUG = 'contextrecord' TABLE_COLS = ['parcel.town', 'operation.year', 'operation.operation_code', 'label', 'unit'] @@ -220,6 +221,15 @@ class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): Q(operation__in_charge=user.ishtaruser.person) |\ Q(history_creator=user) + @classmethod + def get_owns(cls, user, menu_filtr=None): + extra_query = {} + if menu_filtr: + extra_query = {'operation': menu_filtr} + owns = super(ContextRecord, cls).get_owns(user, + extra_query=extra_query) + return sorted(owns, key=lambda x: x.cached_label) + def full_label(self): return unicode(self) if not self.operation: -- cgit v1.2.3