Opened 2 years ago

Closed 2 years ago

#33756 closed Cleanup/optimization (invalid)

Code Cleanup on Tutorial Part 3

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

Description (last modified by Mariusz Felisiak)

In the "Writing Your First App" Tutorial Part 3, under the subsection "Write Views That Actually Do Something" (https://docs.djangoproject.com/en/4.0/intro/tutorial03/#write-views-that-actually-do-something), there is an explanation of the render() shortcut as an alternative to HttpResponse() + loader. The explanation includes two code snippets for comparison.

One difference between the code snippets that obfuscates rather than illuminates the difference is the line(s):

    context = {
        'latest_question_list': latest_question_list,
    }

and

    context = {'latest_question_list': latest_question_list}

If this was consistently a multiline or single line across the snippets, that would make it easier for beginning Django users to glance at and understand the difference.

Screenshot attached to illustrate.

Attachments (1)

screenshot.png (73.4 KB ) - added by Kaleb Nyquist 2 years ago.

Download all attachments as: .zip

Change History (3)

by Kaleb Nyquist, 2 years ago

Attachment: screenshot.png added

comment:1 by Kaleb Nyquist, 2 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 2 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

Thanks for the report, however we try to avoid trivial code reformatting unless it's a big problem as it creates extra noise in the history. I don't think this affects the readability of these snippets.

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