Changeset - 6a2918c288c2
[Not reviewed]
0 2 0
Bradley Kuhn (bkuhn) - 8 years ago 2014-07-14 14:49:29
bkuhn@ebb.org
In Django 1.2, feed_dict was deprecated.

Therefore, change this to use the method explained at:

https://docs.djangoproject.com/en/dev/releases/1.2/#feed-in-django-contrib-syndication-feeds
2 files changed with 3 insertions and 10 deletions:
0 comments (0 inline, 0 general)
www/conservancy/feeds.py
Show inline comments
...
 
@@ -229,29 +229,22 @@ class BlogFeed(ConservancyFeedBase):
 

	
 
        if 'author' in GET:
 
            authors = GET.getlist('author')
 
            queryset = queryset.filter(OR_filter('author', 'username', authors))
 

	
 
        if 'tag' in GET:
 
            tags = GET.getlist('tag')
 
            queryset = queryset.filter(OR_filter('tags', 'slug', tags))
 

	
 
        return queryset.order_by('-pub_date')[:10]
 

	
 

	
 
feed_dict = {
 
    'blog': BlogFeed,
 
    'news': PressReleaseFeed,
 
    'omnibus': OmnibusFeed,
 
#    'event-media': RecentEventMediaFeed,
 
}
 
# make each feed know its canonical url
 

	
 
for k, v in feed_dict.items():
 
    v.get_absolute_url = '/feeds/%s/' % k
 

	
 
def view(request):
 
    """Listing of all available feeds
 
    """
 

	
 
    feeds = feed_dict.values()
 
    return render_to_response("feeds.html", {'feeds': feeds})
www/conservancy/urls.py
Show inline comments
...
 
@@ -19,19 +19,19 @@
 

	
 
from django.conf.urls.defaults import *
 
from conservancy.feeds import feed_dict
 
from django.contrib import admin
 

	
 
handler404 = 'modpythoncustom.view404'
 

	
 
admin.autodiscover()
 

	
 
urlpatterns = patterns('',
 
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
    (r'^admin/(.*)', admin.site.urls),
 
    (r'^$', 'conservancy.frontpage.view'),
 
    (r'^feeds/(?P<url>.*)/?$', 'django.contrib.syndication.views.Feed',
 
     {'feed_dict': feed_dict}),
 
    (r'^feeds/blog/?$', 'django.contrib.syndication.views.Feed', BlogFeed()),
 
    (r'^feeds/news/?$', 'django.contrib.syndication.views.Feed', PressReleaseFeed()),
 
    (r'^feeds/omnibus/?$', 'django.contrib.syndication.views.Feed', OmnibusFeed()),
 
    (r'^feeds/?$', 'conservancy.feeds.view'),
 
    (r'^news(/|$)', include('conservancy.apps.news.urls')),
 
    (r'^blog(/|$)', include('conservancy.apps.blog.urls')),
 
)
0 comments (0 inline, 0 general)