fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
option to export non-publishable lesson
[redakcja.git]
/
apps
/
catalogue
/
feeds.py
diff --git
a/apps/catalogue/feeds.py
b/apps/catalogue/feeds.py
old mode 100755
(executable)
new mode 100644
(file)
index
8bb21c3
..
1eb421b
--- a/
apps/catalogue/feeds.py
+++ b/
apps/catalogue/feeds.py
@@
-3,16
+3,27
@@
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from catalogue.models import Book, Chunk
from django.shortcuts import get_object_or_404
from catalogue.models import Book, Chunk
+
class PublishTrackFeed(Feed):
title = u"Planowane publikacje"
link = "/"
def description(self, obj):
class PublishTrackFeed(Feed):
title = u"Planowane publikacje"
link = "/"
def description(self, obj):
- return u"Publikacje, które dotarły co najmniej do etapu: %s" % obj.name
+ tag, published = obj
+ return u"Publikacje, które dotarły co najmniej do etapu: %s" % tag.name
def get_object(self, request, slug):
def get_object(self, request, slug):
- return get_object_or_404(Chunk.tag_model, slug=slug)
+ published = request.GET.get('published')
+ if published is not None:
+ published = published == 'true'
+ return get_object_or_404(Chunk.tag_model, slug=slug), published
+
+ def item_title(self, item):
+ return item.title
def items(self, obj):
def items(self, obj):
- return Book.objects.filter(public=True, _on_track__gte=obj.ordering
- ).order_by('-_on_track', 'title')
+ tag, published = obj
+ books = Book.objects.filter(public=True, _on_track__gte=tag.ordering).order_by('-_on_track', 'title')
+ if published is not None:
+ books = books.filter(_published=published)
+ return books