google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Media RSS feed generation for galleries #118

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I had a need to generate a basic media rss feed 
(http://video.search.yahoo.com/mrss) for 
photologue galleries. It is implemented (attached) and works well for easily 
generating a feed for 
each gallery as well as a basic feed for the gallery archive. It should be very 
easy to integrate into 
photologue with sensible defaults, if there is interest.

Consider this user code added to urls.py:

from utils.feedgenerator import photofeeds
urlpatterns += patterns('',
     url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': photofeeds}),
)

Without customization, this will generate a feed for the gallery archive at
/feeds/gallery/
It will contain a single photo per gallery, as returned by Gallery.sample()

Additionally, each gallery has a dynamic feed available at the url via 
Gallery.title_slug:
/feeds/gallery/gallery-title-slug/
This feed will contain an Item for each Photo in the Gallery

All that is left is to add an autodiscovery feed to your pages in <head>:
e.g Add something like this to gallery_detail.html:

<link rel="alternate" href="/feeds/gallery/{{ object.title_slug }}/" 
type="application/rss+xml" title="Photologue Gallery - {{ object.title }}" 
id="gallery_feed" />

Attachments:
feedgenerator.py (required)
  - Feed implementation

gallery_feed_title.html (optional)
  - Template for rendering item titles in feed

gallery_feed_description.html (optional)
  - Template for rendering item descriptions in feed

photofeed_urls.py (example)
  - Example showing how to customize the feed a bit and add to your urls.py. Assumes 
feedgenerator.py is installed in a utils package and the templates are in 
/templates/feeds/.
Feed will be published 

Original issue reported on code.google.com by ltaylor....@gmail.com on 5 Jun 2009 at 2:54

Attachments:

GoogleCodeExporter commented 9 years ago
Mistake...photofeed_urls.py assumes the templates are in the standard location, 
not in a feed subdir.

Original comment by ltaylor....@gmail.com on 5 Jun 2009 at 2:56