From d399731bf29bf842c756a77ff8a58706bac3d65f Mon Sep 17 00:00:00 2001 From: Martin Matusiak Date: Sat, 22 Feb 2014 13:39:33 +0100 Subject: [PATCH] Fixed #22007 -- Fixed cbv docs - make imports consistent Thanks to trac user kinjal.dixit for the report. --- docs/internals/contributing/writing-code/coding-style.txt | 8 ++++++++ docs/topics/class-based-views/intro.txt | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt index c3d1b7c7582..b0004bd9795 100644 --- a/docs/internals/contributing/writing-code/coding-style.txt +++ b/docs/internals/contributing/writing-code/coding-style.txt @@ -30,6 +30,14 @@ Python style * Use ``InitialCaps`` for class names (or for factory functions that 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:: def foo(): diff --git a/docs/topics/class-based-views/intro.txt b/docs/topics/class-based-views/intro.txt index 5986ff2ea7d..906205b96c8 100644 --- a/docs/topics/class-based-views/intro.txt +++ b/docs/topics/class-based-views/intro.txt @@ -71,7 +71,7 @@ something like:: In a class-based view, this would become:: from django.http import HttpResponse - from django.views.generic.base import View + from django.views.generic 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.base import View + from django.views.generic import View class GreetingView(View): greeting = "Good Day" @@ -198,7 +198,7 @@ A similar class-based view might look like:: from django.http import HttpResponseRedirect from django.shortcuts import render - from django.views.generic.base import View + from django.views.generic import View from .forms import MyForm