[Django] #23000: Wrong path when refereing to the index.html template

8 views
Skip to first unread message

Django

unread,
Jul 10, 2014, 10:18:42 PM7/10/14
to django-...@googlegroups.com
#23000: Wrong path when refereing to the index.html template
-----------------------------------+--------------------
Reporter: maximo.martinez@… | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+--------------------
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))
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23000>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 11, 2014, 3:46:24 AM7/11/14
to django-...@googlegroups.com
#23000: Wrong path when refereing to the index.html template
-----------------------------------+--------------------------------------
Reporter: maximo.martinez@… | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 1.6
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by claudep):

* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0


Comment:

If you follow the instructions about the location of the new template,
there is no problem.
"Within the templates directory you have just created, create another
directory called polls, and within that create a file called index.html.
In other words, your template should be at
polls/templates/polls/index.html."

--
Ticket URL: <https://code.djangoproject.com/ticket/23000#comment:1>

Reply all
Reply to author
Forward
0 new messages