X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/8e82784fa2fe21d9c3828adbf43178a39c7cdea6..773a8c2da4c355af5d81d27a4849e9548e2d8864:/migdal/api.py diff --git a/migdal/api.py b/migdal/api.py old mode 100755 new mode 100644 index 7fd6fe3..d4f031e --- a/migdal/api.py +++ b/migdal/api.py @@ -4,17 +4,19 @@ # from itertools import chain from migdal.models import Entry -from migdal.settings import TYPES +from migdal import app_settings 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}) + object_list = Entry.objects.filter(**{"published_%s" % lang: True} + ).order_by('-published_at_%s' % lang) 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]) + object_list = object_list.filter( + type__in=[t.db for t in app_settings.TYPES if t.on_main]) if category: object_list = object_list.filter(categories=category)