Darwin Tech
Darwin Tech

Reputation: 18929

Django ReverseMatch error

Hi I can't figure this one out. I have in my application urls:

from django.conf.urls.defaults import *
from journal import views
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
...     
url(r'^search/$', views.journal_search, name='journal_search'), 
...
) 

in my views:

def journal_search(request):
if 'q' in request.POST:
    # search code
    ....
return render_to_response('journal_search_results.html',
            locals(),context_instance=RequestContext(request)) 

and in the base.html:

{% load i18n %}
<form id="searchform" action="{% url journal_search %}" method="POST">
{% csrf_token %}<fieldset class="search">
    <label for="search"></label> <input id="search" type="text" name="q" placeholder="{% trans 'Search' %}... ">
</fieldset>

Any idea why I am getting:

 Reverse for 'journal_search' with arguments '()' and keyword arguments '{}' not found.

? Any assistance would be much appreciated.

Upvotes: 0

Views: 81

Answers (1)

U-DON
U-DON

Reputation: 2140

What happens if you run the following in your shell? Any errors?

from django.core.urlresolvers import reverse
reverse('journal.views.journal_search')

If it works in the shell, it might not actually be a problem with the reverse.

Upvotes: 1

Related Questions