[Django] #33542: executing the shell commands promts an error

7 views
Skip to first unread message

Django

unread,
Feb 24, 2022, 8:46:40 PM2/24/22
to django-...@googlegroups.com
#33542: executing the shell commands promts an error
-------------------------------------+-------------------------------------
Reporter: phisp | Owner: nobody
Type: Bug | Status: new
Component: | Version: 4.0
Documentation | Keywords: TemplateResponse
Severity: Normal | request
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
In https://docs.djangoproject.com/en/4.0/ref/template-response/

{{{
>>> t = TemplateResponse(request, 'original.html', {})
}}}


"NameError: name 'request' is not defined"

How can I define request by the shell? HttpRequest?

A link how to define the request in the shell would be appreciated. I know
Documentation isn't a tutorial, annoying is this happens very often and a
deeper understanding with the shell would be helpful.

Thanks for your work

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

Django

unread,
Feb 24, 2022, 9:19:25 PM2/24/22
to django-...@googlegroups.com
#33542: TemplateResponse example missing definition of request

-------------------------------------+-------------------------------------
Reporter: phisp | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 4.0
Severity: Normal | Resolution:
Keywords: TemplateResponse | Triage Stage:
request | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

If you look at the documentation of the `TemplateResponse` arguments a
little earlier, it says: `request` - An `HttpRequest` instance.

I'm doubtful that further clarification would be helpful, especially
because an `original.html` template isn't likely to be present.

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

Django

unread,
Feb 25, 2022, 5:47:36 AM2/25/22
to django-...@googlegroups.com
#33542: TemplateResponse example missing definition of request
-------------------------------------+-------------------------------------
Reporter: phisp | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 4.0
Severity: Normal | Resolution:
Keywords: TemplateResponse | Triage Stage:
request | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Sam):

Based on [https://docs.djangoproject.com/en/dev/internals/contributing
/new-contributors/#first-steps Advice for new contributors], I've been
able to reproduce the bug.

But as [ticket:33542 phisp] says:
>Documentation isn't a tutorial

And I agree with [comment:1 Tim Graham]:
> `TemplateResponse` [...] it says: `request` - An `HttpRequest` instance.


>
> I'm doubtful that further clarification would be helpful, especially
because an `original.html` template isn't likely to be present.

Further explanation would only make sense within a tutorial, describing
the project setup (including `original.html` for example).

I am a Django beginner, with some basic experience in web scraping and no
professional background in computer science.
But I think I would be able to create an
[https://docs.djangoproject.com/en/4.0/ref/request-response/#httprequest-
objects HttpRequest] object, using the source mentioned by Tim.

Therefore regard this ticket as
[https://docs.djangoproject.com/en/dev/internals/contributing/triaging-
tickets/#how-can-i-help-with-triaging "invalid"] and would close it in
this sense.

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

Django

unread,
Feb 25, 2022, 6:00:01 AM2/25/22
to django-...@googlegroups.com
#33542: TemplateResponse example missing definition of request
-------------------------------------+-------------------------------------
Reporter: phisp | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 4.0
Severity: Normal | Resolution: invalid

Keywords: TemplateResponse | Triage Stage:
request | 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


Comment:

Agreed.

--
Ticket URL: <https://code.djangoproject.com/ticket/33542#comment:3>

Reply all
Reply to author
Forward
0 new messages