def start_search(request):
if request.method == 'POST':
form = SearchForm(request.POST, request.FILES)
if form.is_valid():
s = form.save()
return render_to_response('index.html', {'search': s,})
else:
raise Exception("Invalid form")
else:
return HttpResponseRedirect('/FaceSearch/')
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Dj Gilcrease
Sent: Friday, 16 January 2009 10:10 AM
To: [email protected]
Subject: Re: reverse() problems (NoReverseMatch)
whats your start_search function look like
Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com
On Thu, Jan 15, 2009 at 5:00 PM, Ian Cullinan <[email protected]> wrote:
> I'm trying to use django.core.urlresolvers.reverse in the url method of a
> custom storage manager, but I keep getting NoReverseMatch and I don't know
> why so I cut everything back to the simplest case I could think of and I'm
> still not getting anywhere.
>
>
>
> My urls.py:
>
>
>
> from django.conf.urls.defaults import *
>
> from facesearch.views import start_search
>
> urlpatterns = patterns('',
>
> (r'^FaceSearch/search/$', start_search),
>
> )
>
>
>
> Then in the interactive shell I do:
>
>
>
>>>> from django.core.urlresolvers import reverse
>
>>>> from facesearch.views import start_search
>
>>>> reverse(start_search)
>
> Traceback (most recent call last):
>
> File "<console>", line 1, in <module>
>
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line
> 254, in reverse
>
> *args, **kwargs)))
>
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line
> 243, in reverse
>
> "arguments '%s' not found." % (lookup_view, args, kwargs))
>
> NoReverseMatch: Reverse for '<function start_search at 0x8ee7ae4>' with
> arguments '()' and keyword arguments '{}' not found.
>
> Passing the view function by name doesn't work either.
>
>
>
> What's going on here? Am I doing something rather stupid?
>
>
>
> Thanks in advance,
>
>
>
> Ian Cullinan
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---