This is a very simple way of getting authenticated RSS feeds in django, by slightly changing the django.contrib.syndication.views
1) copy django/contrib/syndication/views.py into mysite/feeds/views.py
2) replace the contents of that file with the snippet
3) any feeds which you require login just add them to the auth_required list. In this case I require login for /feeds/mystuff/ so I make auth_required = ['mystuff']
My directory structure is like this:
mysite/feeds/
views.py
feedmodels.py
feedmodels.py is just where you make your feed models (see http://docs.djangoproject.com/en/dev/ref/contrib/syndication/ where they give an example of "LatestEntries")
[urls.py] - this is what I add in urls.py
from mysite.feeds.feedmodels import Latest,MyPersonalStuff
feeds = {
'latest':Latest,
'mystuff':MyPersonalStuff,
}
(r'^feeds/(?P<url>.*)/$', 'mysite.feeds.views.feed', {'feed_dict': feeds}),
###########################################################################
- authentication
- feed
- rss
- simple
Provides a basic implementation of Yahoo's [MediaRSS](http://video.search.yahoo.com/mrss) format for [Photologue](http://code.google.com/p/django-photologue/) galleries
Simplest usage:
I have feedgenerator.py in a utils directory. Import photofeeds and hook up the feed url in your URLConf:
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>. An RSS agent like CoolIris can then parse your gallery and provide a slick view of your photos.
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" />
`
- feed
- rss
- photologue
- syndication