Tuesday, August 28, 2012

Re: reverse function giving me NoReverseMatch exception

Sorry got posted before I finished.

Let me start again.

I have a view function defined like this:

my_view(request, uuid, backend=None)

my urls.py have this:

UUID_PATTERN = r'(?P<uuid>[A-Za-z0-9_-]{22})'
BACKEND = r'(?P<backend>[a-z])'

url(r'^my/view/%s/%s/$' % (UUID_PATTERN, BACKEND),
        'my_view', name='my_view_backend'),

url(r'^my/view/%s/$' % UUID_PATTERN,
        'my_view', name='my_view'),

I am reversing using the following syntax:

reverse('my_view_backend', args=['oUEwFLybQJWruvJPmZLtnw', 'mybackend'])

this should match the first pattern but I keep getting a NoReverseMatch exception. I am aware that I am missing something simple but I am not sure what.

TIA,
nav

On Wednesday, August 29, 2012 11:54:08 AM UTC+5:30, nav wrote:
Dear Folks,

I have the following view function defined like this:

my_view(request, uuid, backend=None)

--
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/-/hJKvDCXt4SgJ.
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.

No comments:

Post a Comment