Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upgraded djangoproject.com feeds to use new syndication framework

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@1336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit bb2bdd8cb6687c5a82d1829cece69a1a833bca91 1 parent 0daf365
jacob authored
10 django_website/apps/aggregator/feeds.py
View
@@ -0,0 +1,10 @@
+from django.contrib.syndication.feeds import Feed
+from django.models.aggregator import feeditems
+
+class CommunityAggregatorFeed(Feed):
+ title = "The Django community aggregator"
+ link = "http://www.djangoproject.com/community/"
+ description = "Aggregated feeds from the Django community."
+
+ def items(self):
+ return feeditems.get_list(limit=10)
11 django_website/apps/blog/feeds.py
View
@@ -0,0 +1,11 @@
+from django.contrib.syndication.feeds import Feed
+from django.models.blog import entries
+
+class WeblogEntryFeed(Feed):
+ title = "The Django weblog"
+ link = "http://www.djangoproject.com/weblog/"
+ description = "Latest news about Django, the Python Web framework."
+
+ def items(self):
+ return entries.get_list(limit=10)
+
41 django_website/settings/main_rss.py
View
@@ -1,41 +0,0 @@
-from django.core import rss
-from django.models.blog import entries
-from django.models.comments import freecomments
-from django.models.aggregator import feeditems
-
-weblog_entry_feed = rss.FeedConfiguration(
- slug = 'weblog',
- title_cb = lambda param: "The Django weblog",
- link_cb = lambda param: "http://www.djangoproject.com/weblog/",
- description_cb = lambda param: "Latest news about Django, the Python Web framework.",
- get_list_func_cb = lambda obj: entries.get_list,
- get_list_kwargs = {
- 'limit': 10,
- }
-)
-
-recent_comments = rss.FeedConfiguration(
- slug = 'comments',
- title_cb = lambda param: "Recent comments on djangoproject.com",
- link_cb = lambda param: "http://www.djangoproject.com/comments/",
- description_cb = lambda param: "Recent comments posted to djangoproject.com.",
- get_list_func_cb = lambda obj: freecomments.get_list,
- get_list_kwargs = {
- 'limit': 15,
- }
-)
-
-community_aggregator = rss.FeedConfiguration(
- slug = 'community',
- title_cb = lambda param: "The Django community aggregator",
- link_cb = lambda param: "http://www.djangoproject.com/community/",
- description_cb = lambda param: "Aggregated feeds from the Django community.",
- get_list_func_cb = lambda obj: feeditems.get_list,
- get_list_kwargs = {
- 'limit' : 10,
- }
-)
-
-rss.register_feed(recent_comments)
-rss.register_feed(weblog_entry_feed)
-rss.register_feed(community_aggregator)
11 django_website/settings/urls/main.py
View
@@ -1,4 +1,7 @@
from django.conf.urls.defaults import *
+from django.contrib.comments.feeds import LatestFreeCommentsFeed
+from django_website.apps.aggregator.feeds import CommunityAggregatorFeed
+from django_website.apps.blog.feeds import WeblogEntryFeed
comments_info_dict = {
'app_label': 'comments',
@@ -13,12 +16,18 @@
'extra_lookup_kwargs': {'select_related' : True},
}
+feeds = {
+ 'weblog' : WeblogEntryFeed,
+ 'comments' : LatestFreeCommentsFeed,
+ 'community' : CommunityAggregatorFeed,
+}
+
urlpatterns = patterns('',
(r'^weblog/', include('django_website.apps.blog.urls.blog')),
(r'^documentation/', include('django_website.apps.docs.urls.docs')),
(r'^comments/$', 'django.views.generic.list_detail.object_list', comments_info_dict),
(r'^comments/', include('django.contrib.comments.urls.comments')),
(r'^community/$', 'django.views.generic.list_detail.object_list', aggregator_info_dict),
- (r'^rss/', include('django.conf.urls.rss')),
+ (r'^rss/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
(r'', include('django.contrib.flatpages.urls')),
)
Please sign in to comment.
Something went wrong with that request. Please try again.