from django.utils.feedgenerator import Atom1Feed from django.shortcuts import get_object_or_404 from news.models import News from projects.models import Project from news.feeds import NewsFeed class ProjectNewsFeed(NewsFeed): def get_object(self, *args, **kwargs): return get_object_or_404(Project, **kwargs) def title(self, obj): return 'sublab.org - %s' % obj.name def description(self, obj): return obj.description def link(self, obj): return obj.get_absolute_url() def items(self, obj): return obj.news.all()[:10] class ProjectNewsFeedAtom(ProjectNewsFeed): feed_type = Atom1Feed subtitle = ProjectNewsFeed.description