1

I am trying to generate a full rss feed, however when loading the feed in Mail, it just shows the title, with a read more link at the bottom. I have tried several different options. But none seem to work.

I would like to generate the feed with a combination of several feeds in my modl.

Here is the code i have tried:

class LatestEvents(Feed):
    description_template = "events_description.html"

    def title(self):
        return "%s Events" % SITE.name

    def link(self):
        return '/events/'

    def items(self):
        events = list(Event.objects.all().order_by('-published_date')[:5])
        return events

    author_name = 'Latest Events'

    def item_pubdate(self, item):
        return item.published_date

And in my template which is stored in TEMPLATE_ROOT/feeds/

{{ obj.description|safe }}
<h1>Event Location Details</h1>
{{ obj.location|safe }}

Even if i hard code the description it does not work. The solution below does not work, and testing the feed in Firefox also do not display the content.

Basically i want to create a full feed.

ismail
  • 3,882
  • 5
  • 36
  • 47

2 Answers2

2

If anyone comes across this, the problem was the link to the template.

i.e description_template = "events_description.html"

I assumed django would handle checking the template directory, however you have to specify where the template is located. i.e

description_template = "events/events_description.html"

ismail
  • 3,882
  • 5
  • 36
  • 47
0

I take it that you are trying to subscribe to the feed via email... correct?

To do this, you need to add a couple things.

First, import the "content" extension. This is done in the opening <rss> element like this:

<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">

Then, add the full desription to an element like this:

<content:encoded><![CDATA[
  <p>The full description goes here bla bla bla.</p> 
  <p>You can use HTML tags too.</p>
]]></content:encoded>

This is in addition to the regular description tag required by RSS and can be added to each <item> element.

Brant
  • 5,721
  • 4
  • 36
  • 39
  • Nope, not email using mac osx mail which has an RSS reader built in. – ismail Apr 22 '10 at 13:16
  • Tried this, but does not work. Added what you said to the template. – ismail Apr 22 '10 at 13:19
  • I'm not sure what mac osx mail pulls for its description. You'll have to look and find out what element(s) they pull to give you a full article. – Brant Apr 22 '10 at 14:13