Commit 3d6474e1 authored by Varun Sharma's avatar Varun Sharma Committed by Tim Graham
Browse files

Fixed #25385 -- Allowed importing views.generic.View from views.View.

parent 0bc5cd62
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
from django.views.generic.base import View

__all__ = ['View']
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ Imports

* Use convenience imports whenever available. For example, do this::

      from django.views.generic import View
      from django.views import View

  instead of::

+7 −2
Original line number Diff line number Diff line
@@ -19,7 +19,12 @@ View
.. class:: django.views.generic.base.View

    The master class-based base view. All other class-based views inherit from
    this base class.
    this base class. It isn't strictly a generic view and thus can also be
    imported from ``django.views``.

    .. versionchanged:: 1.10

        The ability to import from ``django.views`` was added.

    **Method Flowchart**

@@ -30,7 +35,7 @@ View
    **Example views.py**::

        from django.http import HttpResponse
        from django.views.generic import View
        from django.views import View

        class MyView(View):

+2 −1
Original line number Diff line number Diff line
@@ -208,7 +208,8 @@ Forms
Generic Views
^^^^^^^^^^^^^

* ...
* The :class:`~django.views.generic.base.View` class can now be imported from
  ``django.views``.

Internationalization
^^^^^^^^^^^^^^^^^^^^
+3 −3
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ something like::
In a class-based view, this would become::

    from django.http import HttpResponse
    from django.views.generic import View
    from django.views import View

    class MyView(View):
        def get(self, request):
@@ -113,7 +113,7 @@ and methods in the subclass. So that if your parent class had an attribute
``greeting`` like this::

    from django.http import HttpResponse
    from django.views.generic import View
    from django.views import View

    class GreetingView(View):
        greeting = "Good Day"
@@ -199,7 +199,7 @@ A similar class-based view might look like::

    from django.http import HttpResponseRedirect
    from django.shortcuts import render
    from django.views.generic import View
    from django.views import View

    from .forms import MyForm

Loading