summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-06-02 16:07:31 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-06-02 16:07:31 +0200
commit4566ddf6dfaa7d6a888e41638238096a4f8f53fc (patch)
tree7c6f95d37fe429c118496e3f797f69df88aa129b /ishtar_common/models.py
parente403a92298d8108b55a9631c65a98a660f451d61 (diff)
downloadIshtar-4566ddf6dfaa7d6a888e41638238096a4f8f53fc.tar.bz2
Ishtar-4566ddf6dfaa7d6a888e41638238096a4f8f53fc.zip
Generic management of baskets in owns items
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 33ae05369..f3974d04d 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -243,10 +243,15 @@ class OwnPerms:
user = IshtarUser.objects.get(user_ptr=user)
if user.is_anonymous():
return cls.objects.filter(pk__isnull=True)
+ items = []
+ if hasattr(cls, 'BASKET_MODEL'):
+ items = list(cls.BASKET_MODEL.objects.filter(user=user).all())
query = cls.get_query_owns(user)
if not query:
return cls.objects.filter(pk__isnull=True)
- return cls.objects.filter(query).order_by(*cls._meta.ordering)
+ items += list(
+ cls.objects.filter(query).order_by(*cls._meta.ordering).all())
+ return items
class Cached(object):