This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu May 07 04:58:20 -0700 2009 | |
| |
LICENSE | Wed Nov 04 13:52:41 -0800 2009 | |
| |
README.markdown | Wed Nov 04 13:52:41 -0800 2009 | |
| |
doc/ | Sun Dec 13 07:10:00 -0800 2009 | |
| |
setup.py | Wed Nov 04 13:52:41 -0800 2009 | |
| |
syndication/ | Thu Dec 17 15:21:16 -0800 2009 |
README.markdown
syndication-view
syndication-view is a refactor of Django's syndication contrib app, primarily to turn feeds into class-based views, but will also fix a number of long standing tickets.
Installation
$ python setup.py install
Usage
articles/feeds.py:
from syndication.views import Feed
from articles.models import Article, Category
class ArticleFeed(Feed):
title = "example.com news"
link = "/sitenews/"
description = "Latest news from example.com."
def items(self):
return Article.objects.all()[:15]
class CategoryArticleFeed(ArticleFeed):
def title(self, obj):
return 'example.com: %s' % obj
def get_object(self, request, slug):
return Category.objects.get(slug=slug)
def items(self, obj):
return Article.objects.filter(category=obj)[:15]
urls.py:
from articles.feeds import ArticleFeed, CategoryArticleFeed
urlpatterns = patterns('',
# ...
(r'^articles/feed/$', ArticleFeed()),
(r'^articles/feed/(?P<slug>[a-z0-9\-]+)/$', CategoryArticleFeed()),
# ...
)
The API for the feed object in syndication.views is almost identical to that in Django's contrib app, except get_object() takes the request and any arguments passed to it from the URL rather than the "bits".







