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_finds/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'archaeological_finds/models.py') diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index 15ed32120..0f069e1d8 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -275,6 +275,7 @@ class FindBasket(Basket): class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): CHECK_DICT = dict(CHECK_CHOICES) SHOW_URL = 'show-find' + SLUG = 'find' TABLE_COLS = ['label', 'material_types', 'datings.period', 'base_finds.context_record.parcel.town', 'base_finds.context_record.operation.year', @@ -564,6 +565,14 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): ishtaruser.person) |\ Q(history_creator=user) + @classmethod + def get_owns(cls, user, menu_filtr=None): + extra_query = {} + if menu_filtr: + extra_query = {'base_finds__context_record': menu_filtr} + owns = super(Find, cls).get_owns(user, extra_query=extra_query) + return sorted(owns, key=lambda x: x.cached_label) + def save(self, *args, **kwargs): super(Find, self).save(*args, **kwargs) -- cgit v1.2.3