2012-03-10 00:05:24 +00:00
|
|
|
from django.contrib.auth.models import User
|
|
|
|
from django.contrib.syndication.views import Feed
|
|
|
|
from django.shortcuts import get_object_or_404
|
2012-03-20 17:53:53 +00:00
|
|
|
from django.utils.feedgenerator import Atom1Feed
|
2012-03-10 00:05:24 +00:00
|
|
|
|
|
|
|
class SupporterWishlistFeed(Feed):
|
2012-03-20 17:53:53 +00:00
|
|
|
feed_type = Atom1Feed
|
2012-03-10 00:05:24 +00:00
|
|
|
def get_object(self, request, supporter):
|
|
|
|
return get_object_or_404(User, username=supporter)
|
|
|
|
|
|
|
|
def title(self, obj):
|
|
|
|
return "Latest wishbooks for %s on unglue.it" % obj.username
|
|
|
|
|
|
|
|
def description(self, obj):
|
|
|
|
return "Latest wishbooks for %s on unglue.it" % obj.username
|
|
|
|
|
|
|
|
def link(self, obj):
|
|
|
|
return "/%s/feed/" % obj.username
|
|
|
|
|
|
|
|
def item_title(self, item):
|
|
|
|
return "%s" % item.title
|
|
|
|
|
|
|
|
def item_link(self, item):
|
|
|
|
return "/work/%s" % item.id
|
|
|
|
|
2012-03-10 01:04:21 +00:00
|
|
|
def items(self, obj):
|
|
|
|
return obj.wishlist.works.all().order_by('-id')[:5]
|