Add Add "georss" tag to feeds

11 views
Skip to first unread message

Daniel de la Cuesta

unread,
Dec 20, 2007, 4:27:30 AM12/20/07
to django...@googlegroups.com
Hi all,
 
I want to add the geo tag (with latitude and longitude) to each item of my feeds:
 
<georss:point>45.256 -71.92</georss:point>
I am using the feeds framework:

class LatestEvents(Feed):
       title = "Latest Events"
       link = "/events/"
       def items(self):
           return Event.objects.order_by('-start_date')[:5]
Is there any way to add the new node to each item returned by "items()"
Thank you.




Daniel de la Cuesta Navarrete
Coordinador de Proyectos e I+D
BERTIENTE Mobile Techonologies
Teléfono:627091831

Este correo electrónico y, en su caso, cualquier fichero anexo, contiene información confidencial exclusivamente dirigida a su(s) destinatario(s). Toda copia o divulgación deberá ser autorizada por BERTIENTE.

This e-mail and any attachments are confidential and exclusively directed to its address(es). Any copy or distribution will have to be authorized by BERTIENTE.

David Larlet

unread,
Jan 2, 2008, 1:22:43 PM1/2/08
to django-d...@googlegroups.com, django...@googlegroups.com

Le 20 déc. 07 à 10:27, Daniel de la Cuesta a écrit :

> Hi all,
>
> I want to add the geo tag (with latitude and longitude) to each item
> of my feeds:
>
> <georss:point>45.256 -71.92</georss:point>
> I am using the feeds framework:
> class LatestEvents(Feed): title = "Latest Events" link
> = "/events/" def items(self): return
> Event.objects.order_by('-start_date')[:5]
> Is there any way to add the new node to each item returned by
> "items()"
> Thank you.


Daniel,

Attached is my current solution which is not really elegant but works.
That's why I cross post to the developers mailing-list, maybe we can
find a better way to handle that? There is a lot of duplicate code in
my solution (and maybe there is a better one?, let me know) but I
could easily generate a patch against the trunk for that.

Btw, I had noticed a bug in the SyndicationFeed class of django
feedgenerator, language is the only parameter where force_unicode is
applied and it returns u"None". This "conversion" cause problem in the
"if self.feed['language'] is not None:" test. If you replace
force_unicode by to_unicode it works. I'd submitted a bug and a patch
on Trac, see #6303.

While we are at feeds, I got a "cosmetic" question. It seems that each
generated feed in Django is not highlighted by Firefox when you read
the source. Is there a reason to that? I can't find a way to find the
cause.

Thanks,
David

geofeedgenerator.py
Reply all
Reply to author
Forward
0 new messages