Reputation: 5402
What I'm trying to do is: Have my inclusion tag using feedparser:
from django.template import Library
import feedparser
@register.inclusion_tag('home/dashboard.html')
def rss_extract(tag):
rss = feedparser.parse(tag)
return {'rss': rss }
get the rss pertaining to each tag (an example would be: http://blog.myblog.com/tag/tag_name/feed/) object that the user has. And return the feed into my dashboard.html:
{% for tag in profile.tags.all|slice:':3' %}
{% rss_extract http://blog.myblog.com/tag/{{ tag }}/feed/ %}
{% for r in rss.entries|slice:':2' %}
<li> <a href="{{ r.link }}" target="_blank" title="{{ r.title }}">{{ r.title }}</a></li>
{% endfor %}
{% endfor %}
The error: Exception Value: rss_extract takes 1 arguments
How do I get the link to go into the inclusion tag properly?
Thanks for your help in advance.
Upvotes: 0
Views: 180
Reputation: 5496
Does it work if you replace:
http://blog.myblog.com/tag/{{ tag }}/feed/
with:
http://blog.myblog.com/tag/somethingToTest/feed/
If yes, I guess you need to prepare the URL before to pass it. Also it doesn't make sense to "show" it there using {{ }}. That's meant to output HTML.
Upvotes: 1