From 8c3d4988fddebd8e797a92e2c9203f67f2d7a28f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 9 Sep 2016 14:32:28 +0200 Subject: Shortcut menu: show all dependent items of pinned but not own parent item --- ishtar_common/models.py | 8 ++++---- ishtar_common/views.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 9e48df8d2..29dedd113 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -235,7 +235,7 @@ class OwnPerms: return cls.objects.filter(query).count() @classmethod - def get_owns(cls, user, extra_query={}): + def get_owns(cls, user, replace_query={}): """ Get Own items """ @@ -247,11 +247,11 @@ class OwnPerms: if hasattr(cls, 'BASKET_MODEL'): items = list(cls.BASKET_MODEL.objects.filter(user=user).all()) query = cls.get_query_owns(user) - if not query: + if not query and not replace_query: return cls.objects.filter(pk__isnull=True) q = cls.objects.filter(query) - if extra_query: - q = q.filter(**extra_query) + if replace_query: + q = cls.objects.filter(**replace_query) items += list(q.order_by(*cls._meta.ordering).all()) return items diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 5022aa08e..95c4dbd76 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -236,6 +236,7 @@ def shortcut_menu(request): if not new_selected_item and current: try: item = model.objects.get(pk=int(current)) + new_selected_item = item items.append((item.pk, shortify(unicode(item), 60), True, item.get_short_menu_class())) except (model.DoesNotExist, ValueError): -- cgit v1.2.3