mirror of
https://github.com/django/django.git
synced 2025-12-15 21:45:20 +00:00
Fixed #25385 -- Allowed importing views.generic.View from views.View.
This commit is contained in:
parent
0bc5cd6280
commit
3d6474e1a5
7 changed files with 19 additions and 10 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ We'll demonstrate this with the ``Author`` model we used in the
|
|||
|
||||
from django.http import HttpResponseForbidden, HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from django.views.generic import View
|
||||
from django.views import View
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from books.models import Author
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ You can of course pass through keyword arguments to
|
|||
would in your URLconf, such as if you wanted the ``AuthorInterest`` behavior
|
||||
to also appear at another URL but using a different template::
|
||||
|
||||
from django.views.generic import View
|
||||
from django.views import View
|
||||
|
||||
class AuthorDetail(View):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue