GET object is accessible everywhere in BlogFeed.
This solution is likely a hack to ensure the GET object is regularly accessible.
This commit is contained in:
parent
e75642ed47
commit
387275c9d4
1 changed files with 9 additions and 2 deletions
|
@ -154,6 +154,9 @@ class BlogFeed(ConservancyFeedBase):
|
||||||
get_absolute_url = '/feeds/blog/'
|
get_absolute_url = '/feeds/blog/'
|
||||||
|
|
||||||
def get_object(self, request):
|
def get_object(self, request):
|
||||||
|
# This is a hack: keep GET object handy so I always have it in all methods.
|
||||||
|
if not hasattr(self, 'GET') and request and hasattr(request, 'GET'):
|
||||||
|
self.GET = request.GET
|
||||||
return request
|
return request
|
||||||
|
|
||||||
def title(self, obj):
|
def title(self, obj):
|
||||||
|
@ -223,7 +226,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.get_object().GET
|
GET = self.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:
|
||||||
|
@ -241,7 +244,11 @@ class BlogFeed(ConservancyFeedBase):
|
||||||
return item.pub_date
|
return item.pub_date
|
||||||
|
|
||||||
def items(self, obj):
|
def items(self, obj):
|
||||||
GET = obj.GET
|
# This is a hack: keep GET object handy so I always have it in all methods.
|
||||||
|
if not hasattr(self, 'GET') and request and hasattr(request, 'GET'):
|
||||||
|
self.GET = request.GET
|
||||||
|
|
||||||
|
GET = self.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