Writing a very basic search form in Django Writing a very basic search form in Django django django

Writing a very basic search form in Django


Ok so the action handling the search in your views.py is supposed to be search but as I suspected in your urls.py you don't call the search method anywhere.

Where do you execute search method?

Urls should be like this:

urlpatterns = patterns('',url(r'^home/$', 'search.views.home'),url(r'^results/$', 'search.views.search'),# or at least have a url for the search view

Note the action attribute in your form

It is action="/results/". This means result view is the one who is supposed to be handling the form. You may also change this to action="/search/" and have your urls like this:

urlpatterns = patterns('',url(r'^home/$', 'search.views.home'),url(r'^results/$', 'search.views.results'),url(r'^search/$', 'search.views.search'),