{% url ... %} does not work for callable?

12 views
Skip to first unread message

Torsten Bronger

unread,
Jan 21, 2015, 1:54:25 PM1/21/15
to django...@googlegroups.com
Hallöchen!

I cannot get the following working:

In urls.py:

url(r"^samples/(?P<sample_name>.+)/edit/$", sample.edit),

In the template:

{% url 'samples.views.sample.edit' sample_name="whatever" %}

I constantly get a NoReverseMatch, even if I pass the view function
with its full path samples.views.sample.edit in urls.py. I know
that a named url() solves the problem. Is this the only way if I
use a callable in url() (which will become mandatory in Django 2.0)?

Tschö,
Torsten.

--
Torsten Bronger Jabber ID: torsten...@jabber.rwth-aachen.de
or http://bronger-jmp.appspot.com

Torsten Bronger

unread,
Jan 22, 2015, 3:29:09 AM1/22/15
to django...@googlegroups.com
Hallöchen!

Torsten Bronger writes:

> I cannot get the following working:
>
> In urls.py:
>
> url(r"^samples/(?P<sample_name>.+)/edit/$", sample.edit),
>
> In the template:
>
> {% url 'samples.views.sample.edit' sample_name="whatever" %}
>
> I constantly get a NoReverseMatch,

I solved the probem; it doesn't have directly to do with reverse
resolution of URLs. Instead, I failed to add @wraps() to one of my
own decorators, and reserve() could not "recognize" the view
function anymore.
Reply all
Reply to author
Forward
0 new messages