Hi Bryan,

On Sun, 2007-05-06 at 06:23 +0000, Bryan Veloso wrote:
> Created a feed using the syndication tutorial on the main Django
> website... acutally I used the one that powers the feed from the
> Django weblog.
> 
> from django.contrib.syndication.feeds import Feed
> from avalonstar.blogs.models import Entry
> import datetime
> 
> class LatestEntries(Feed):
>     author_name    = "Bryan Veloso"
>     author_email   = "xxx"
>     title          = "Avalonstar"
>     link           = "http://avalonstar.com";
>     description    = "The latest from Avalonstar, the home of Bryan
> Veloso."
> 
>     def items(self):
>         return
> Entry.objects.filter(pub_date__lte=datetime.datetime.now())[:10]
> 
> But when I try to use this in a feed reader, the publish date is
> always the date and time the feed was updated, rather than when the
> post was created. When I tried to import posts into Virb, it gave the
> old 12/31/69 date. I tried to use item_date(self), but that didn't
> seem to work the way I wanted it to.

The feed framework looks at the attribute called "pubdate" to determine
the publication date for items. Your attribute is called "pub_date", so
ti isn't being examined. Simplest solution here is to add a pubdate()
method or property to your model that returns the value of
self.pub_date.

I suspect you cannot put the simpler and more obvious "pubdate =
pub_date" in your model because the model managers will think there is
an extra database field when it is creating the model class (although I
may be wrong).

If you are needing to debug things like this in the future, one place to
look for a lot of information is in django/utils/feedgenerator.py. That
is where the feeds are constructed, so you can see which attributes the
feed class is looking for when creating particular items. It looks like
you are just using the default setup, so your feed will be using the
Rss201rev2Feed class in that file. Look in the write_items() method for
the code that writes out each thing returned from your items() function.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to