Opened 11 years ago

Closed 11 years ago

#20952 closed Cleanup/optimization (worksforme)

Django 1.5 Tutorial Part 3, Test after Update of Polls/urls.py Fails

Reported by: diek@… Owned by: nobody
Component: Documentation Version: 1.5
Severity: Normal Keywords: views
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Good day,
I really appreciate the effort that you put forth. I hit a bit of wall last night, and perhaps should have picked up on it myself but I did the tutorials 1-3 back to back and maybe my brain was not %100. The test recommended after the user changes urls: "The next step is "Take a look in your browser, at “/polls/34/”. Unless the user has added another 33 records to polls_poll this fails, the majority of users would not have done that. It works perfect with /polls/1/. Using '34' is very confusing, especially for new users. I think it needs clarification which would need maybe one sentence.

Thank you,

derrick

Change History (8)

comment:1 by Tim Graham, 11 years ago

Resolution: worksforme
Status: newclosed

At that point in the tutorial, we've only stubbed out the views with something like return HttpResponse("You're looking at poll %s." % poll_id) -- there's no database operation yet. It sounds like you're following the tutorial out of order.

comment:2 by diek@…, 11 years ago

Good Morning,
I did not follow them out of order. If you look at tut 3, for 1.5. This is an exact quote from Part 3, Writing more views: "Take a look in your browser, at “/polls/34/”. It’ll run the detail() method and display whatever ID you provide in the URL. Try “/polls/34/results/” and “/polls/34/vote/” too – these will display the placeholder results and voting pages."

I imagine you are volunteer, but I have to say closing my topic without giving a chance to explain was a bit premature.

derrick

comment:3 by diek@…, 11 years ago

Resolution: worksforme
Status: closednew

comment:4 by Tim Graham, 11 years ago

It will display a placeholder page, won't it? There isn't any fetching from the database in the views that have been implemented thus far:

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

def results(request, poll_id):
    return HttpResponse("You're looking at the results of poll %s." % poll_id)

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

comment:5 by diek@…, 11 years ago

timo,
From the tutorial https://docs.djangoproject.com/en/1.5/intro/tutorial03/, right after what you have written it states:
"Take a look in your browser, at “/polls/34/”. It’ll run the detail() method and display whatever ID you provide in the URL. Try “/polls/34/results/” and “/polls/34/vote/” too – these will display the placeholder results and voting pages." This fails because there is no record 34. There is a record 1, and as I discovered it works with polls/1/. Here is my concern, you are an expert but someone like myself is brand new to django. When I read a tutorial I follow it step by step. As a beginner I have to trust a tutorial, that has been written and edited several times; when I get an error, I do not doubt the tutorial and I think I did something incorrect. The topic is slightly complicated as well, so I do not understand why the tutorial would use record 34, all it did is cause confusion. And really I cannot understand why you would not remove 34, or explain that you need to use an existing id. Again please try to look at this from a new learner's perspective and not an expert.

Thank you,

derrick

comment:6 by Tim Graham, 11 years ago

There shouldn't be a failure because the views (up to this point) simply display whatever ID you pass in the URL. The code does not verify that a poll with the given ID actually exists. Please tell me if I'm wrong.

comment:7 by diek@…, 11 years ago

timo,
Ohhh man do I feel dumb. I just checked it again. You are correct, it works perfectly with 34. Obviously I was doing something wrong.

My apologies. I will reread Part 3 again, I am obviously not understanding it as well as I should.

derrick

comment:8 by Tim Graham, 11 years ago

Resolution: worksforme
Status: newclosed

No problem, sorry it took me so long to convey my point. If you have any other suggestions, don't hesitate to let us know.

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