Django: reverse lookup URL of feeds?
- by Santa
I am having trouble doing a reverse URL lookup for Django-generated feeds.
I have the following setup in urls.py:
feeds = {
'latest': LatestEntries,
}
urlpatterns = patterns('',
# ...
# enable feeds (RSS)
url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
{'feed_dict': feeds}, name='feeds_view'),
)
I have tried using the following template tag:
<a href="{% url feeds_view latest %}">RSS feeds</a>
But the resulting link is not what want (http://my.domain.com/feeds//). It should be http://my.domain.com/feeds/latest/.
For now, I am using a hack to generate the URL for the template:
<a href="http://{{ request.META.HTTP_HOST }}/feeds/latest">RSS feeds</a>
But, as you can see, it clearly is not DRY. Is there something I am missing?