1 # -*- coding: utf-8 -*-
2 from django.contrib.syndication.views import Feed
3 from django.shortcuts import get_object_or_404
4 from catalogue.models import Book, Chunk
6 class PublishTrackFeed(Feed):
7 title = u"Planowane publikacje"
10 def description(self, obj):
12 return u"Publikacje, które dotarły co najmniej do etapu: %s" % tag.name
14 def get_object(self, request, slug):
15 published = request.GET.get('published')
16 if published is not None:
17 published = published == 'true'
18 return get_object_or_404(Chunk.tag_model, slug=slug), published
20 def item_title(self, item):
25 books = Book.objects.filter(public=True, _on_track__gte=tag.ordering
26 ).order_by('-_on_track', 'title')
27 if published is not None:
28 books = books.filter(_published=published)