1👍
✅
First of all function-based views are deprecated. Try a class-based view like django.views.generic.base.TemplateView
.
If you want to use function-based views django.shortcuts.render
is useful:
from django.shortcuts import render
def index(request):
return render(request, 'templates/index.html', {'extra_context' : 'hello'})
get_template
returns a TemplateDoesNotExist
exception because you missed an ‘l’ in ‘poll’:
{% for poll in latest_pol_list %}
I’m not removing the rest of my post because it’s good practice for you, hope you will find it useful.
Source:stackexchange.com