Opened 5 years ago

Closed 5 years ago

#30762 closed Cleanup/optimization (worksforme)

Code detail error in tutorial 03.

Reported by: Fnanshan Owned by: nobody
Component: Documentation Version: 2.2
Severity: Normal Keywords: beginners
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In the link https://docs.djangoproject.com/en/2.2/intro/tutorial03/, 'Writing more views ¶ "section, on the question of existing code.

def detail(request, question_id):
    return HttpResponse("You're looking at question %s." % question_id)

def results(request, question_id):
    response = "You're looking at the results of question %s."
    return HttpResponse(response % question_id)

def vote(request, question_id):
    return HttpResponse("You're voting on question %s." % question_id)

Index () method is not available in polls/views. py, where as

 path(", views. Index, name='index')

It is available in polls/views.


It's easy for beginners to get confused.

Change History (1)

comment:1 by Mariusz Felisiak, 5 years ago

Resolution: worksforme
Status: newclosed
Summary: Code detail errorCode detail error in tutorial 03.

Tutorial 03 is a continuation of the first tutorial where we added index() to polls/views.py, everything works fine for me.

Note: See TracTickets for help on using tickets.
Back to Top