{{{
>>> 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.
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>
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>
* status: new => closed
* resolution: => invalid
Comment:
Agreed.
--
Ticket URL: <https://code.djangoproject.com/ticket/33542#comment:3>