feeds.py 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. from django.contrib.syndication.views import Feed
  2. from darkroom.models import Photo, Gallery
  3. from django.conf import settings
  4. from django.contrib.sites.models import Site
  5. class LatestPhotosFeed(Feed):
  6. current_site = Site.objects.get(id=settings.SITE_ID)
  7. title = current_site.name + " multimedia"
  8. link = current_site.domain
  9. if current_site.name == "penobscotbaypress.com":
  10. description = "Photos from the Blue Hill Peninsula and Deer Isle in Maine."
  11. elif current_site.name == "castinepatriot.com":
  12. description = "Photos from around Castine and Penobscot, Maine."
  13. elif current_site.name == "islandadvantages.com":
  14. description = "Photos from around Deer Isle and Stonington, Maine."
  15. elif current_site.name == "weeklypacket.com":
  16. description = "Photos from around the towns of the Blue Hill Peninsula Maine."
  17. def items(self):
  18. return Photo.objects.published()[:30]
  19. def item_title(self, item):
  20. return item.title
  21. def item_link(self, item):
  22. return item.get_absolute_url()
  23. # def item_enclosure_url(self, item):
  24. # return item.get_detail_url()
  25. def item_description(self, item):
  26. return item.description