Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#34334 closed Bug (duplicate)

There might be an error in the Django Tutorial No. 5

Reported by: alv2017 Owned by: nobody
Component: Documentation Version: 4.1
Severity: Normal Keywords: Documentation Tutorial Bug
Cc: v.alishauskaite@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

At the moment I'm going through the fifth Django Tutorial on unit testing: https://docs.djangoproject.com/en/4.1/intro/tutorial05/

I notices that in a number of places the following expression is used:

response.context['latest_question_list']

This doesn't work, and I think that instead there should be

response.context_data['latest_question_list']

I'm using Django 4.1.6

Brgds,
Vitalija

Change History (4)

comment:1 by Tim Graham, 23 months ago

Component: Error reportingDocumentation
Owner: set to nobody
Resolution: duplicate
Status: newclosed

Duplicate of #22912. Please re-read the tutorial's mention of setup_test_environment() and make sure you call it.

in reply to:  1 comment:2 by alv2017, 23 months ago

Replying to Tim Graham:

Duplicate of #22912. Please re-read the tutorial's mention of setup_test_environment() and make sure you call it.

Hmm... What about the actual tests?
I would agree with you if you were speaking about the shell script, but for application tests, I'm afraid, this is not true.

Last edited 23 months ago by alv2017 (previous) (diff)

comment:3 by Tim Graham, 23 months ago

Django's test runner calls setup_test_environment(). Is it not working for you?

in reply to:  3 comment:4 by alv2017, 23 months ago

Replying to Tim Graham:

Django's test runner calls setup_test_environment(). Is it not working for you?

Thanks for the explanation Tim. I didn't realize at the beginning that setup_test_environment() is running under the hood when tests are run.

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