[Django] #33756: Code Cleanup on Tutorial Part 3

1 view
Skip to first unread message

Django

unread,
May 31, 2022, 11:48:42 AM5/31/22
to django-...@googlegroups.com
#33756: Code Cleanup on Tutorial Part 3
------------------------------------------------+------------------------
Reporter: KalebNyquist | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/33756>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 31, 2022, 11:49:11 AM5/31/22
to django-...@googlegroups.com
#33756: Code Cleanup on Tutorial Part 3
-------------------------------------+-------------------------------------
Reporter: KalebNyquist | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 4.0
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by KalebNyquist):

* Attachment "screenshot.png" added.

Django

unread,
May 31, 2022, 11:50:00 AM5/31/22
to django-...@googlegroups.com
#33756: Code Cleanup on Tutorial Part 3
-------------------------------------+-------------------------------------
Reporter: KalebNyquist | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by KalebNyquist:

Old description:

> 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.

New description:

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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33756#comment:1>

Django

unread,
May 31, 2022, 12:38:56 PM5/31/22
to django-...@googlegroups.com
#33756: Code Cleanup on Tutorial Part 3
-------------------------------------+-------------------------------------
Reporter: Kaleb Nyquist | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: 4.0
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Old description:

> 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.

New description:

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.

--

Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/33756#comment:2>

Reply all
Reply to author
Forward
0 new messages