Wednesday, February 1, 2012

Re: template error in html forms

Please check your template path in settings.py.




On Wed, Feb 1, 2012 at 5:29 PM, TANYA <taninat@gmail.com> wrote:
In views.py, when I add this code gives template error.
def search(request):     error = False     if 'q' in request.GET:         q = request.GET['q']         if not q:             error = True         else:             books = Book.objects.filter(title__icontains=q)             return render_to_response('search_results.html',                 {'books': books, 'query': q})     return render_to_response('search_form.html',         {'error': error})

I have created search_form.html and search.html and put it in "template" directory but get this error ,

TemplateDoesNotExist at /search/

search_form.html
Request Method: GET
Request URL: http://127.0.0.1:8000/search/
Django Version: 1.3.1
Exception Type: TemplateDoesNotExist
Exception Value:
search_form.html
Exception Location: /usr/local/lib/python2.6/dist-packages/django/template/loader.py in find_template, line 138
Python Executable: /usr/bin/python

--
TANYA

--
You received this message because you are subscribed to the Google Groups "Django users" group.
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.



--
Ankit Rai


--
You received this message because you are subscribed to the Google Groups "Django users" group.
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