mirror of
https://github.com/django/django.git
synced 2025-03-13 10:50:55 +00:00
[1.6.x] Fixed #22007 -- Fixed cbv docs - make imports consistent
Thanks to trac user kinjal.dixit for the report. Backport of d399731bf29bf842c756a77ff8a58706bac3d65f from master.
This commit is contained in:
parent
98070b94a9
commit
4f6ff7ee85
@ -27,6 +27,14 @@ Python style
|
|||||||
* Use ``InitialCaps`` for class names (or for factory functions that
|
* Use ``InitialCaps`` for class names (or for factory functions that
|
||||||
return classes).
|
return classes).
|
||||||
|
|
||||||
|
* Use convenience imports whenever available. For example, do this::
|
||||||
|
|
||||||
|
from django.views.generic import View
|
||||||
|
|
||||||
|
Don't do this::
|
||||||
|
|
||||||
|
from django.views.generic.base import View
|
||||||
|
|
||||||
* In docstrings, use "action words" such as::
|
* In docstrings, use "action words" such as::
|
||||||
|
|
||||||
def foo():
|
def foo():
|
||||||
|
@ -71,7 +71,7 @@ something like::
|
|||||||
In a class-based view, this would become::
|
In a class-based view, this would become::
|
||||||
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.views.generic.base import View
|
from django.views.generic import View
|
||||||
|
|
||||||
class MyView(View):
|
class MyView(View):
|
||||||
def get(self, request):
|
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::
|
``greeting`` like this::
|
||||||
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.views.generic.base import View
|
from django.views.generic import View
|
||||||
|
|
||||||
class GreetingView(View):
|
class GreetingView(View):
|
||||||
greeting = "Good Day"
|
greeting = "Good Day"
|
||||||
@ -198,7 +198,7 @@ A similar class-based view might look like::
|
|||||||
|
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.views.generic.base import View
|
from django.views.generic import View
|
||||||
|
|
||||||
from .forms import MyForm
|
from .forms import MyForm
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user