[Django] #28294: self.request in views may not be documented yet

43 views
Skip to first unread message

Django

unread,
Jun 9, 2017, 6:10:39 PM6/9/17
to django-...@googlegroups.com
#28294: self.request in views may not be documented yet
-------------------------------------+-------------------------------------
Reporter: Tony | Owner: nobody
Narlock |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 1.11
Documentation |
Severity: Normal | Keywords: documentation views
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
In the community, there is a convention of pulling HttpRequest from
self.request. Especially due to the prominence of .as_view as a pattern to
invoke views.

This binding occurs in [https://docs.djangoproject.com/en/1.11/ref/class-
based-views/base/#django.views.generic.base.View.as_view .as_view()]:
https://github.com/django/django/blob/711123e/django/views/generic/base.py#L63

CBV documentation doesn't mention it:
https://docs.djangoproject.com/en/1.11/topics/class-based-views/intro/

If a user is using .as_view() in a high level view, they won't see
HttpRequest being passed in as a method argument unless they're using
[https://docs.djangoproject.com/en/1.11/ref/class-based-views/base/#view
something like .get() or .post()]

Documentation should be clarify where and how self.request in views comes
into the life cycle of a view.

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

Django

unread,
Jun 10, 2017, 8:19:48 PM6/10/17
to django-...@googlegroups.com
#28294: Document request/args/kwargs attributes of class-based views
--------------------------------------+------------------------------------
Reporter: Tony Narlock | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: documentation views | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


Comment:

Using the documentation search for "self.request" I found a mention in the
[https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-
display/#dynamic-filtering Dynamic filtering] section, but I agree that it
(and other attributes like `self.args` and `self.kwargs`) could be
mentioned elsewhere -- perhaps in
[https://docs.djangoproject.com/en/1.11/ref/class-based-
views/base/#django.views.generic.base.View.as_view View.as_view()] as
that's where the assignment happens.

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

Django

unread,
Jun 25, 2017, 2:51:30 PM6/25/17
to django-...@googlegroups.com
#28294: Document request/args/kwargs attributes of class-based views
-------------------------------------+-------------------------------------
Reporter: Tony Narlock | Owner: Michael
Type: | Vasiliou
Cleanup/optimization | Status: assigned

Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: documentation views | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Michael Vasiliou):

* owner: nobody => Michael Vasiliou
* status: new => assigned


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

Django

unread,
Jun 26, 2017, 3:35:22 PM6/26/17
to django-...@googlegroups.com
#28294: Document request/args/kwargs attributes of class-based views
-------------------------------------+-------------------------------------
Reporter: Tony Narlock | Owner: Michael
Type: | Vasiliou
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 1.11
Severity: Normal | Resolution:
Keywords: documentation views | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/8674 PR]

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

Django

unread,
Jun 28, 2017, 10:01:23 AM6/28/17
to django-...@googlegroups.com
#28294: Document request/args/kwargs attributes of class-based views
-------------------------------------+-------------------------------------
Reporter: Tony Narlock | Owner: Michael
Type: | Vasiliou
Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: documentation views | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"63e9a71ec4917ddf7f4acbf69a7ccdafb76fb2ee" 63e9a71]:
{{{
#!CommitTicketReference repository=""
revision="63e9a71ec4917ddf7f4acbf69a7ccdafb76fb2ee"
Fixed #28294 -- Doc'd request/args/kwargs attributes of class-based views.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28294#comment:4>

Django

unread,
Jun 28, 2017, 10:02:00 AM6/28/17
to django-...@googlegroups.com
#28294: Document request/args/kwargs attributes of class-based views
-------------------------------------+-------------------------------------
Reporter: Tony Narlock | Owner: Michael
Type: | Vasiliou
Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: documentation views | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Tim Graham <timograham@…>):

In [changeset:"a6756195c1a11eee10c16c96fe95d52e22e1d9ba" a6756195]:
{{{
#!CommitTicketReference repository=""
revision="a6756195c1a11eee10c16c96fe95d52e22e1d9ba"
[1.11.x] Fixed #28294 -- Doc'd request/args/kwargs attributes of class-
based views.

Backport of 63e9a71ec4917ddf7f4acbf69a7ccdafb76fb2ee from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28294#comment:5>

Reply all
Reply to author
Forward
0 new messages