瀏覽代碼

Fixed #19335 - Typo and cleanups in docs/topics/class-based-views/index.txt

Tim Graham 12 年之前
父節點
當前提交
e2b1808196
共有 1 個文件被更改,包括 11 次插入9 次删除
  1. 11 9
      docs/topics/class-based-views/index.txt

+ 11 - 9
docs/topics/class-based-views/index.txt

@@ -24,9 +24,9 @@ Basic examples
 Django provides base view classes which will suit a wide range of applications.
 Django provides base view classes which will suit a wide range of applications.
 All views inherit from the :class:`~django.views.generic.base.View` class, which
 All views inherit from the :class:`~django.views.generic.base.View` class, which
 handles linking the view in to the URLs, HTTP method dispatching and other
 handles linking the view in to the URLs, HTTP method dispatching and other
-simple features. :class:`~django.views.generic.base.RedirectView` is for a simple HTTP
-redirect, and :class:`~django.views.generic.base.TemplateView` extends the base class
-to make it also render a template.
+simple features. :class:`~django.views.generic.base.RedirectView` is for a
+simple HTTP redirect, and :class:`~django.views.generic.base.TemplateView`
+extends the base class to make it also render a template.
 
 
 
 
 Simple usage in your URLconf
 Simple usage in your URLconf
@@ -34,7 +34,8 @@ Simple usage in your URLconf
 
 
 The simplest way to use generic views is to create them directly in your
 The simplest way to use generic views is to create them directly in your
 URLconf. If you're only changing a few simple attributes on a class-based view,
 URLconf. If you're only changing a few simple attributes on a class-based view,
-you can simply pass them into the ``as_view`` method call itself::
+you can simply pass them into the
+:meth:`~django.views.generic.base.View.as_view` method call itself::
 
 
     from django.conf.urls import patterns, url, include
     from django.conf.urls import patterns, url, include
     from django.views.generic import TemplateView
     from django.views.generic import TemplateView
@@ -43,9 +44,10 @@ you can simply pass them into the ``as_view`` method call itself::
         (r'^about/', TemplateView.as_view(template_name="about.html")),
         (r'^about/', TemplateView.as_view(template_name="about.html")),
     )
     )
 
 
-Any arguments given will override the ``template_name`` on the
-A similar overriding pattern can be used for the ``url`` attribute on
-:class:`~django.views.generic.base.RedirectView`.
+Any arguments passed to :meth:`~django.views.generic.base.View.as_view` will
+override attributes set on the class. In this example, we set ``template_name``
+on the ``TemplateView``. A similar overriding pattern can be used for the
+``url`` attribute on :class:`~django.views.generic.base.RedirectView`.
 
 
 
 
 Subclassing generic views
 Subclassing generic views
@@ -67,8 +69,8 @@ and override the template name::
 
 
 Then we just need to add this new view into our URLconf.
 Then we just need to add this new view into our URLconf.
 `~django.views.generic.base.TemplateView` is a class, not a function, so we
 `~django.views.generic.base.TemplateView` is a class, not a function, so we
-point the URL to the ``as_view`` class method instead, which provides a
-function-like entry to class-based views::
+point the URL to the :meth:`~django.views.generic.base.View.as_view` class
+method instead, which provides a function-like entry to class-based views::
 
 
     # urls.py
     # urls.py
     from django.conf.urls import patterns, url, include
     from django.conf.urls import patterns, url, include