fnp
/
prawokultury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
favicon
[prawokultury.git]
/
migdal
/
api.py
diff --git
a/migdal/api.py
b/migdal/api.py
old mode 100755
(executable)
new mode 100644
(file)
index
7ed17ec
..
7fd6fe3
--- a/
migdal/api.py
+++ b/
migdal/api.py
@@
-2,12
+2,13
@@
# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
+from itertools import chain
from migdal.models import Entry
from migdal.settings import TYPES
from django.utils.translation import get_language
from migdal.models import Entry
from migdal.settings import TYPES
from django.utils.translation import get_language
-def entry_list(entry_type=None, category=None):
+def entry_list(entry_type=None, category=None
, promobox=False
):
lang = get_language()
object_list = Entry.objects.filter(**{"published_%s" % lang: True})
if entry_type:
lang = get_language()
object_list = Entry.objects.filter(**{"published_%s" % lang: True})
if entry_type:
@@
-16,4
+17,10
@@
def entry_list(entry_type=None, category=None):
object_list = object_list.filter(type__in=[t.db for t in TYPES if t.on_main])
if category:
object_list = object_list.filter(categories=category)
object_list = object_list.filter(type__in=[t.db for t in TYPES if t.on_main])
if category:
object_list = object_list.filter(categories=category)
+
+ if promobox:
+ promo = list(object_list.filter(promo=True)[:promobox])
+ #object_list = object_list.exclude(pk__in=[p.pk for p in promo])
+ object_list.promobox = promo
+
return object_list
return object_list