Opened 10 years ago
Closed 10 years ago
#23000 closed Bug (invalid)
Wrong path when refereing to the index.html template
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
When updating the view in order to reference the newly created template. Loader is asked to load 'polls/index.html'. However, it throws an exception. Since it's looking for it in the projects folder. It's supposed to be 'index.html'.
from django.http import HttpResponse from django.template import RequestContext, loader from polls.models import Poll def index(request): latest_poll_list = Poll.objects.order_by('-pub_date')[:5] template = loader.get_template('polls/index.html') context = RequestContext(request, { 'latest_poll_list': latest_poll_list, }) return HttpResponse(template.render(context))
Note:
See TracTickets
for help on using tickets.
If you follow the instructions about the location of the new template, there is no problem.