Generic views and url issues
I've been trying to understand how to use generic views. I've followed some tutorials, and read through Django docs, but I can't get the url function to work in my templates.
I get the error
NoReverseMatch at /testadcall/
Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not found.
in my urls.py
queryset = {'queryset': Adcall.objects.order_by('name')}
urlpatterns = patterns('django.views.generic.list_detail',
url(r'^$','object_list', queryset, name="adcalls"),
url(r'(?P<object_id>\d+)/detail/$', 'object_detail', queryset, name="detail"),
)
in my template for the list view:
{% load url from future %}
{% if object_list %}
<ul>
{% for adcall in object_list %}
<li><a href="{% url 'detail' adcall.id %}/">{{ adcall.name }}</a></li>
{% endfor %}
</ul>
{% endif %}
I've tried no quotes, single quotes, and double quotes around the url name "detail", with no apparent effect.
Am I wrong in thinking that this should work?
I'm using Django 1.4.3, Python 2.7.3
Thanks so much.
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/M6Qrx89JeBkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home