use get_object() in BlogFeed to get request object
Upon reading https://docs.djangoproject.com/en/dev/ref/contrib/syndication/#a-complex-example I think that this is what I need to do to forward-port this Django 1.2 to Django 1.4's Feed objects.
This commit is contained in:
parent
2a572dcffa
commit
e75642ed47
1 changed files with 11 additions and 7 deletions
|
@ -153,10 +153,13 @@ class BlogFeed(ConservancyFeedBase):
|
||||||
link = "/blog/"
|
link = "/blog/"
|
||||||
get_absolute_url = '/feeds/blog/'
|
get_absolute_url = '/feeds/blog/'
|
||||||
|
|
||||||
def title(self):
|
def get_object(self, request):
|
||||||
|
return request
|
||||||
|
|
||||||
|
def title(self, obj):
|
||||||
answer = "The Software Freedom Conservancy Blog"
|
answer = "The Software Freedom Conservancy Blog"
|
||||||
|
|
||||||
GET = self.request.GET
|
GET = obj.GET
|
||||||
tags = []
|
tags = []
|
||||||
if 'author' in GET:
|
if 'author' in GET:
|
||||||
tags = GET.getlist('author')
|
tags = GET.getlist('author')
|
||||||
|
@ -182,10 +185,10 @@ class BlogFeed(ConservancyFeedBase):
|
||||||
answer += "."
|
answer += "."
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
def description(self):
|
def description(self, obj):
|
||||||
answer = "Blogs at the Software Freedom Conservancy"
|
answer = "Blogs at the Software Freedom Conservancy"
|
||||||
|
|
||||||
GET = self.request.GET
|
GET = obj.GET
|
||||||
tags = []
|
tags = []
|
||||||
if 'author' in GET: tags = GET.getlist('author')
|
if 'author' in GET: tags = GET.getlist('author')
|
||||||
if 'tag' in GET: tags += GET.getlist('tag')
|
if 'tag' in GET: tags += GET.getlist('tag')
|
||||||
|
@ -220,7 +223,7 @@ class BlogFeed(ConservancyFeedBase):
|
||||||
return item.author.formal_name
|
return item.author.formal_name
|
||||||
|
|
||||||
def item_author_email(self, item):
|
def item_author_email(self, item):
|
||||||
GET = self.request.GET
|
GET = self.get_object().GET
|
||||||
if not 'author' in GET:
|
if not 'author' in GET:
|
||||||
return "%s@sfconservancy.org" % item.author
|
return "%s@sfconservancy.org" % item.author
|
||||||
else:
|
else:
|
||||||
|
@ -236,8 +239,9 @@ class BlogFeed(ConservancyFeedBase):
|
||||||
|
|
||||||
def item_pubdate(self, item):
|
def item_pubdate(self, item):
|
||||||
return item.pub_date
|
return item.pub_date
|
||||||
def items(self):
|
|
||||||
GET = self.request.GET
|
def items(self, obj):
|
||||||
|
GET = obj.GET
|
||||||
|
|
||||||
def OR_filter(field_name, subfield_name, objs):
|
def OR_filter(field_name, subfield_name, objs):
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
Loading…
Reference in a new issue