Actually, it's not the url() function that makes it work, it's specifying the
view function by name.
urlpatterns = patterns('',
(r'^FaceSearch/search/$', 'facesearch.views.start_search'),
)
works,
from facesearch.views import start_search
urlpatterns = patterns('',
(r'^FaceSearch/search/$', start_search),
)
doesn't.
Why doesn't it work when you pass a function reference for the view? When you
put a string in patterns, reverse() works by sting or function reference.
http://docs.djangoproject.com/en/dev/topics/http/urls/#reverse seems to imply
that it should work either way. Is this a bug?
Cheers,
Ian Cullinan
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Ian Cullinan
Sent: Friday, 16 January 2009 10:57 AM
To: [email protected]
Subject: RE: reverse() problems (NoReverseMatch)
Using the url() function in patterns made it work (even without the name),
thanks!
Now I just have to make it work in my storage manager :)
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Dj Gilcrease
Sent: Friday, 16 January 2009 10:45 AM
To: [email protected]
Subject: Re: reverse() problems (NoReverseMatch)
try
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^FaceSearch/search/$', 'facesearch.views.start_search',
name="face-search'),
)
============
from django.core.urlresolvers import reverse
reverse('face-search')
Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---