All,
I have a vexing question that I have not been able to solve when
trying to use the Feeds framework in Django. Everything appears to
work well, except when I subscribe to the feed in both Google Reader
and Bloglines, the publication date comes up as the time that the feed
was accessed. The update field contains the correct time of
publication, but this means that the feed is not correctly sorted by
date since all of the entries are considered to be found "right now."
The feed can be found at http://mikebader.net/blog/entries/feed and
the code that I used is pasted below.
Thanks much for any help that anyone might be able to provide.
best,
mike
from django.core.exceptions import ObjectDoesNotExist
from django.utils.feedgenerator import Atom1Feed
from django.contrib.comments.models import Comment
from django.contrib.sites.models import Site
from django.contrib.syndication.feeds import Feed
from coltrane.models import Category, Entry
current_site = Site.objects.get_current()
class LatestEntriesFeed(Feed):
author_name = "Mike Bader"
copyright = "http://%s/about/" % current_site.domain
description = "Latest entries posted to Mike Bader's website"
feed_type = Atom1Feed
item_copyright = "http://%s/blog/about/" % current_site.domain
item_author_name = "Mike Bader"
item_author_link = "http://%s/" % current_site.domain
link = "/blog/entries/feed"
title = "%s: Latest entries" % current_site.name
def items(self):
return Entry.live.all()[:15]
def item_pubdate(self, item):
return item.pub_date
def item_guid(self, item):
return "tag:%s,%s:%s" % (current_site.domain,
item.pub_date.strftime('%Y-%m-%d'),
item.get_absolute_url())
def item_categories(self, item):
return [c.title for c in item.categories.all()]
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.