I've been following along James Bennett's Practical Django Projects
and I'm confused on how to render a template with the correct url that
maps to the urlconf for categorized feeds. I understand that the url
needs to be in the form feeds/categories/audio but how do I build this
url in the template without hard coding it? I've tried the following:
urlconf:
feeds = { 'entries': LatestEntriesFeed, 'links': LatestLinksFeed,
'categories': CategoryFeed, 'tweets': LatestTweetsFeed }
(r'^feeds/categories/(?P<url>.*)/$',
'django.contrib.syndication.views.feed', { 'feed_dict': feeds },
'category_feed'),
in the template:
<li><a href="{% url category_feed category.slug %}">
{{ category.title }}</a></li>
which yields:
Slug u'audio' isn't registered. -- because categories needs to be
passed in to <url>
...and
(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
{ 'feed_dict': feeds }, 'category_feed'),
which results in a malformed url:
/feeds//categories/audio//
Thanks for any help,
J
--
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.