1 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.contrib.syndication.views import Feed
5 from django.shortcuts import get_object_or_404
6 from catalogue.models import Book, Chunk
9 class PublishTrackFeed(Feed):
10 title = u"Planowane publikacje"
13 def description(self, obj):
15 return u"Publikacje, które dotarły co najmniej do etapu: %s" % tag.name
17 def get_object(self, request, slug):
18 published = request.GET.get('published')
19 if published is not None:
20 published = published == 'true'
21 return get_object_or_404(Chunk.tag_model, slug=slug), published
23 def item_title(self, item):
28 books = Book.objects.filter(public=True, _on_track__gte=tag.ordering
29 ).order_by('-_on_track', 'title')
30 if published is not None:
31 books = books.filter(_published=published)