El jue., 3 may. 2018 a las 17:38, Avitab Ayan Sarmah (<avitabay...@gmail.com>) escribió:
> > *polls/views.py*: > > from django.http import HttpResponse > from django.template import loader > > from . models import Question > > def index(request): > return HttpResponse("Hello, world.You're at the polls index.") > latest_question_list = Question.objects.order_by('-pub_date')[:5] > output = ', '.join([q.question_text for q in latest_question_list]) > return HttpResponse(output) > latest_question_list = Question.objects.order_by('-pub_date')[:5] > template = loader.get_template('polls/index.html') > context = { > 'latest_question_list': latest_question_list, > } > return HttpResponse(template.render(context, request)) > > Your function index(request) inside polls/views.py is badly written (you have three function returns). Seems you are following the tutorial but not removing the previous examples: def index(request): latest_question_list = Question.objects.order_by('-pub_date')[:5] context = {'latest_question_list': latest_question_list} return render(request, 'polls/index.html', context) -- Fidel Leon fi...@flm.cat -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHXg%3DN2SNuyAsAzk7mYfBB5rahtD3fRSa4vTbL92BQf5CHg-Nw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.