(reply inline)

On Thu, Jan 24, 2013 at 5:09 AM,  <amy.cerr...@cbsinteractive.com> wrote:
> 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 %}
>

try:
{% url 'detail' object_id=adcall.id %}

since you have object_id defined as a keyword param in the url, you
will need to specify it as a keyword param in the {% url %} tag, I
*think* :)

let know if that works -
best've luck,
Sanjay

> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to