[Django] #25385: Import of Views

55 views
Skip to first unread message

Django

unread,
Sep 11, 2015, 12:34:59 PM9/11/15
to django-...@googlegroups.com
#25385: Import of Views
--------------------------------------+------------------------
Reporter: jambonrose | Owner: jambonrose
Type: Cleanup/optimization | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------
Whenever I talk about class-based views and how their concept is separate
from generic views (typically in a class setting), the question I am asked
is invariably: if they are different, why do we import `View` from
`django.views.generic`?

To help developers better avoid confusion and better separate the
concepts, I would like to change the import of the `View` class. Ideally:

from django.views import View

I would furthermore like to move `View` from the generic directory into
it's own module.

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

Django

unread,
Sep 11, 2015, 12:46:54 PM9/11/15
to django-...@googlegroups.com
#25385: Import of Views
-------------------------------------+-------------------------------------
Reporter: jambonrose | Owner:
Type: | jambonrose

Cleanup/optimization | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Have you discussed the idea with anyone? If not, could you please raise it
on the DevelopersMailingList to see if there are any objections?

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

Django

unread,
Sep 11, 2015, 12:47:56 PM9/11/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View

-------------------------------------+-------------------------------------
Reporter: jambonrose | Owner:
Type: | jambonrose
Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* component: Core (URLs) => Generic views


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

Django

unread,
Sep 22, 2015, 10:42:23 AM9/22/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
-------------------------------------+-------------------------------------
Reporter: jambonrose | Owner:
Type: | jambonrose
Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

[https://groups.google.com/d/topic/django-
developers/sdYPQnfcXGU/discussion django-developers thread]

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

Django

unread,
Sep 23, 2015, 10:08:08 AM9/23/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
-------------------------------------+-------------------------------------
Reporter: jambonrose | Owner:
Type: | jambonrose
Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Unreviewed => Accepted


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

Django

unread,
Nov 12, 2015, 8:17:28 PM11/12/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
-------------------------------------+-------------------------------------
Reporter: jambonrose | Owner:
Type: | jambonrose
Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* easy: 0 => 1


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

Django

unread,
Nov 16, 2015, 9:05:30 AM11/16/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
-------------------------------------+-------------------------------------
Reporter: jambonrose | Owner:
Type: | jambonrose
Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by auvipy):

anyone working on this? or volunteer needed? I'm interested to work on it
:D

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:6>

Django

unread,
Nov 16, 2015, 10:25:54 AM11/16/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
-------------------------------------+-------------------------------------
Reporter: jambonrose | Owner:
Type: | jambonrose
Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

If there's no activity on a ticket in weeks, it's probably fine to
reassign it.

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:7>

Django

unread,
Nov 21, 2015, 7:58:39 AM11/21/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned

Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by auvipy):

* owner: jambonrose => auvipy
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:8>

Django

unread,
Nov 21, 2015, 8:10:47 AM11/21/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by auvipy):

Hi tim,

View class need to be moved from generic module to views module, what
whould be the module name? base.py? or view.py?

after moving specific classes it will be needed to fix the import in
existing all modules/files too. does the contextmixin need to be moved
along with VIEW class?

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:9>

Django

unread,
Nov 21, 2015, 8:25:25 AM11/21/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by auvipy):

+ deprecation warnings needed too for moved classes?

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:10>

Django

unread,
Nov 21, 2015, 5:06:37 PM11/21/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timgraham):

I think it's enough to add an import for `from django.views.generic.base
import View` in `django/views/__init__.py`. I don't see much gain in
moving the code.

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:11>

Django

unread,
Nov 22, 2015, 4:23:42 AM11/22/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by auvipy):

Replying to [comment:11 timgraham]:


> I think it's enough to add an import for `from django.views.generic.base
import View` in `django/views/__init__.py`. I don't see much gain in
moving the code.

that seems much simpler then!!!

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:12>

Django

unread,
Nov 28, 2015, 7:39:21 AM11/28/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by auvipy):

PR created

https://github.com/django/django/pull/5742

Docs + Release notes needed.

** should It be back ported to 1.8 and 1.9?

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:13>

Django

unread,
Nov 28, 2015, 8:19:26 AM11/28/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by auvipy):

./django/views/__init__.py:1:1: F401 'View' imported but unused
Build step 'Execute shell' marked build as failure
Setting status of 3b403668b22bea5315bc1c6fbb8237527d43ebb4 to FAILURE with
url http://djangoci.com/job/flake8/6233/ and message: 'Build finished. No
test results found.'
Using context: flake8
Finished: FAILURE

Then test should be added too to make the build pass?

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:14>

Django

unread,
Nov 28, 2015, 8:25:57 AM11/28/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timgraham):

You can fix the flake8 failure by adding `__all__ = ['View']` in that
file.

It's a new feature, so it's not a candidate for backport. See our
[https://docs.djangoproject.com/en/dev/internals/release-process
/#supported-versions supported versions policy].

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:15>

Django

unread,
Nov 28, 2015, 10:54:07 AM11/28/15
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by auvipy):

ok thanks will update accordingly

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:16>

Django

unread,
Jan 5, 2016, 4:32:55 PM1/5/16
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by auvipy):

I guess only release notes and some docs update and squash commit required

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:17>

Django

unread,
Jan 8, 2016, 1:02:52 PM1/8/16
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

PR: https://github.com/django/django/pull/5951

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:18>

Django

unread,
Jan 8, 2016, 1:07:16 PM1/8/16
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by auvipy):

Replying to [comment:18 varun]:
> PR: https://github.com/django/django/pull/5951
Hi Varun, I've already send a PR and the PR is still open. besides I
haven't deassigned the issue yet :) so to avoid duplicate works better to
ask the assigned guy first.

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:19>

Django

unread,
Jan 8, 2016, 11:06:56 PM1/8/16
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by varun):

Replying to [comment:19 auvipy]:
Hi !!
I saw your PR and there wasn't any activity or follow up in that from last
18 days. I guess that's a reasonable period to reassign the ticket. There
wasn't much of work in this anyway :)

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:20>

Django

unread,
Jan 11, 2016, 8:19:35 AM1/11/16
to django-...@googlegroups.com
#25385: Allow importing django.views.generic.View from django.views.View
--------------------------------------+------------------------------------
Reporter: jambonrose | Owner: auvipy
Type: Cleanup/optimization | Status: closed

Component: Generic views | Version: master
Severity: Normal | Resolution: fixed

Keywords: | 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:"3d6474e1a50dbaf9684f7fb34bfccb77630f27be" 3d6474e1]:
{{{
#!CommitTicketReference repository=""
revision="3d6474e1a50dbaf9684f7fb34bfccb77630f27be"
Fixed #25385 -- Allowed importing views.generic.View from views.View.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25385#comment:21>

Reply all
Reply to author
Forward
0 new messages