diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-09 14:32:28 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-09 14:32:28 +0200 |
commit | 8c3d4988fddebd8e797a92e2c9203f67f2d7a28f (patch) | |
tree | af639c67b2f1637d4a8526776e556906a3fbe882 /ishtar_common | |
parent | 4ebe47362d27a8bc824e12aee25f958eacb81a38 (diff) | |
download | Ishtar-8c3d4988fddebd8e797a92e2c9203f67f2d7a28f.tar.bz2 Ishtar-8c3d4988fddebd8e797a92e2c9203f67f2d7a28f.zip |
Shortcut menu: show all dependent items of pinned but not own parent item
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 8 | ||||
-rw-r--r-- | ishtar_common/views.py | 1 |
2 files changed, 5 insertions, 4 deletions
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): |