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
7 class PublishTrackFeed(Feed):
8 title = u"Planowane publikacje"
11 def description(self, obj):
13 return u"Publikacje, które dotarły co najmniej do etapu: %s" % tag.name
15 def get_object(self, request, slug):
16 published = request.GET.get('published')
17 if published is not None:
18 published = published == 'true'
19 return get_object_or_404(Chunk.tag_model, slug=slug), published
21 def item_title(self, item):
26 books = Book.objects.filter(public=True, _on_track__gte=tag.ordering).order_by('-_on_track', 'title')
27 if published is not None:
28 books = books.filter(_published=published)