feeds.py 814 B

12345678910111213141516171819202122232425262728
  1. from django.contrib.syndication.views import Feed
  2. from documents.models import Document
  3. from django.conf import settings
  4. from django.contrib.sites.models import Site
  5. class LatestDocumentsFeed(Feed):
  6. current_site = Site.objects.get(id=settings.SITE_ID)
  7. title = current_site.name + " documents"
  8. link = current_site.domain
  9. item_copyright = "Copyright (r) 2010, Penobscot Bay Press"
  10. description = "Documents recently published by Penobscot Bay Press"
  11. def items(self):
  12. return Document.published_objects.all()[:30]
  13. def item_pubdate(self, item):
  14. return item.published_on
  15. def item_title(self, item):
  16. return item.title
  17. def item_link(self, item):
  18. return item.get_absolute_url()
  19. def item_description(self, item):
  20. return item.description