X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/3f6f55a25872c1d1465f7bdb59e8a766da9c51cc..d57cb0586003722ceca5c06519d3225686566a78:/migdal/api.py?ds=inline diff --git a/migdal/api.py b/migdal/api.py deleted file mode 100644 index 7fd6fe3..0000000 --- a/migdal/api.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# 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 - - -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: - object_list = object_list.filter(type=entry_type.db) - else: - 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