1 # -*- coding: utf-8 -*-
2 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.contrib.syndication.views import Feed
6 from django.core.urlresolvers import reverse
7 from django.shortcuts import get_object_or_404
8 from django.utils.translation import ugettext as _
10 from migdal.models import Category
11 from migdal.settings import TYPES_DICT
14 class EntriesFeed(Feed):
15 def get_object(self, request, type_db=None, category_slug=None):
16 lang = request.LANGUAGE_CODE
18 category = get_object_or_404(Category, **{'slug_%s' % lang: category_slug})
22 entry_type = TYPES_DICT[type_db]
23 return {'entry_type': entry_type, 'category': category}
26 t = "Prawo kultury, " + _("latest") + " "
28 t += unicode(obj['entry_type'].slug)
32 t += " " + _("in category") + " " + obj['category'].title
37 return reverse('migdal_category', args=[obj['category'].slug])
39 return reverse('migdal_entry_list_%s' % obj['entry_type'].db)
40 return reverse('migdal_main')
43 return api.entry_list(**obj)
45 def item_title(self, item):
48 def item_description(self, item):