Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Create headings and expand CBV docs so that the "Built-In CBV" docs incl... #261

Merged
merged 1 commit into from over 1 year ago

2 participants

Issac Kelly Tim Graham
Issac Kelly

Create headings and expand CBV docs so that the "Built-In CBV" docs include a complete list.

The complete list is preferred so that a single list exists to find any CBV. The previous break-up of this list has made browsing slightly more difficult.

Tim Graham timgraham merged commit 4eaf73d into from August 17, 2012
Tim Graham timgraham closed this August 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 10, 2012
Issac Kelly Create headings and expand CBV docs so that the "Built-In CBV" docs i…
…nclude a complete list.
060ac8e
This page is out of date. Refresh to see the latest.
35  docs/ref/class-based-views/base.txt
@@ -8,6 +8,9 @@ themselves or inherited from. They may not provide all the capabilities
8 8
 required for projects, in which case there are Mixins and Generic class-based
9 9
 views.
10 10
 
  11
+View
  12
+----
  13
+
11 14
 .. class:: django.views.generic.base.View
12 15
 
13 16
     The master class-based base view. All other class-based views inherit from
@@ -31,13 +34,13 @@ views.
31 34
     **Example urls.py**::
32 35
 
33 36
         from django.conf.urls import patterns, url
34  
-        
  37
+
35 38
         from myapp.views import MyView
36  
-        
  39
+
37 40
         urlpatterns = patterns('',
38 41
             url(r'^mine/$', MyView.as_view(), name='my-view'),
39 42
         )
40  
-        
  43
+
41 44
     **Methods**
42 45
 
43 46
     .. method:: dispatch(request, *args, **kwargs)
@@ -61,13 +64,16 @@ views.
61 64
 
62 65
         The default implementation returns ``HttpResponseNotAllowed`` with list
63 66
         of allowed methods in plain text.
64  
-        
65  
-    .. note:: 
  67
+
  68
+    .. note::
66 69
 
67 70
         Documentation on class-based views is a work in progress. As yet, only the
68 71
         methods defined directly on the class are documented here, not methods
69 72
         defined on superclasses.
70 73
 
  74
+TemplateView
  75
+------------
  76
+
71 77
 .. class:: django.views.generic.base.TemplateView
72 78
 
73 79
     Renders a given template, passing it a ``{{ params }}`` template variable,
@@ -84,22 +90,22 @@ views.
84 90
     1. :meth:`dispatch()`
85 91
     2. :meth:`http_method_not_allowed()`
86 92
     3. :meth:`get_context_data()`
87  
-      
  93
+
88 94
     **Example views.py**::
89 95
 
90 96
         from django.views.generic.base import TemplateView
91  
-        
  97
+
92 98
         from articles.models import Article
93 99
 
94 100
         class HomePageView(TemplateView):
95 101
 
96 102
             template_name = "home.html"
97  
-            
  103
+
98 104
             def get_context_data(self, **kwargs):
99 105
                 context = super(HomePageView, self).get_context_data(**kwargs)
100 106
                 context['latest_articles'] = Article.objects.all()[:5]
101 107
                 return context
102  
-                
  108
+
103 109
     **Example urls.py**::
104 110
 
105 111
         from django.conf.urls import patterns, url
@@ -126,12 +132,15 @@ views.
126 132
     * ``params``: The dictionary of keyword arguments captured from the URL
127 133
       pattern that served the view.
128 134
 
129  
-    .. note:: 
  135
+    .. note::
130 136
 
131 137
         Documentation on class-based views is a work in progress. As yet, only the
132 138
         methods defined directly on the class are documented here, not methods
133 139
         defined on superclasses.
134 140
 
  141
+RedirectView
  142
+------------
  143
+
135 144
 .. class:: django.views.generic.base.RedirectView
136 145
 
137 146
     Redirects to a given URL.
@@ -159,7 +168,7 @@ views.
159 168
 
160 169
         from django.shortcuts import get_object_or_404
161 170
         from django.views.generic.base import RedirectView
162  
-        
  171
+
163 172
         from articles.models import Article
164 173
 
165 174
         class ArticleCounterRedirectView(RedirectView):
@@ -176,7 +185,7 @@ views.
176 185
 
177 186
         from django.conf.urls import patterns, url
178 187
         from django.views.generic.base import RedirectView
179  
-        
  188
+
180 189
         from article.views import ArticleCounterRedirectView
181 190
 
182 191
         urlpatterns = patterns('',
@@ -217,7 +226,7 @@ views.
217 226
         behavior they wish, as long as the method returns a redirect-ready URL
218 227
         string.
219 228
 
220  
-    .. note:: 
  229
+    .. note::
221 230
 
222 231
         Documentation on class-based views is a work in progress. As yet, only the
223 232
         methods defined directly on the class are documented here, not methods
24  docs/ref/class-based-views/generic-date-based.txt
@@ -5,6 +5,9 @@ Generic date views
5 5
 Date-based generic views (in the module :mod:`django.views.generic.dates`)
6 6
 are views for displaying drilldown pages for date-based data.
7 7
 
  8
+ArchiveIndexView
  9
+----------------
  10
+
8 11
 .. class:: django.views.generic.dates.ArchiveIndexView
9 12
 
10 13
     A top-level index page showing the "latest" objects, by date. Objects with
@@ -21,12 +24,15 @@ are views for displaying drilldown pages for date-based data.
21 24
     * :class:`django.views.generic.list.MultipleObjectMixin`
22 25
     * :class:`django.views.generic.dates.DateMixin`
23 26
     * :class:`django.views.generic.base.View`
24  
-    
  27
+
25 28
     **Notes**
26 29
 
27 30
     * Uses a default ``context_object_name`` of ``latest``.
28 31
     * Uses a default ``template_name_suffix`` of ``_archive``.
29 32
 
  33
+YearArchiveView
  34
+---------------
  35
+
30 36
 .. class:: django.views.generic.dates.YearArchiveView
31 37
 
32 38
     A yearly archive page showing all available months in a given year. Objects
@@ -86,6 +92,9 @@ are views for displaying drilldown pages for date-based data.
86 92
 
87 93
     * Uses a default ``template_name_suffix`` of ``_archive_year``.
88 94
 
  95
+MonthArchiveView
  96
+----------------
  97
+
89 98
 .. class:: django.views.generic.dates.MonthArchiveView
90 99
 
91 100
     A monthly archive page showing all objects in a given month. Objects with a
@@ -134,6 +143,9 @@ are views for displaying drilldown pages for date-based data.
134 143
 
135 144
     * Uses a default ``template_name_suffix`` of ``_archive_month``.
136 145
 
  146
+WeekArchiveView
  147
+---------------
  148
+
137 149
 .. class:: django.views.generic.dates.WeekArchiveView
138 150
 
139 151
     A weekly archive page showing all objects in a given week. Objects with a
@@ -175,6 +187,9 @@ are views for displaying drilldown pages for date-based data.
175 187
 
176 188
     * Uses a default ``template_name_suffix`` of ``_archive_week``.
177 189
 
  190
+DayArchiveView
  191
+--------------
  192
+
178 193
 .. class:: django.views.generic.dates.DayArchiveView
179 194
 
180 195
     A day archive page showing all objects in a given day. Days in the future
@@ -225,6 +240,9 @@ are views for displaying drilldown pages for date-based data.
225 240
 
226 241
     * Uses a default ``template_name_suffix`` of ``_archive_day``.
227 242
 
  243
+TodayArchiveView
  244
+----------------
  245
+
228 246
 .. class:: django.views.generic.dates.TodayArchiveView
229 247
 
230 248
     A day archive page showing all objects for *today*. This is exactly the
@@ -246,6 +264,10 @@ are views for displaying drilldown pages for date-based data.
246 264
     * :class:`django.views.generic.dates.DateMixin`
247 265
     * :class:`django.views.generic.base.View`
248 266
 
  267
+
  268
+DateDetailView
  269
+--------------
  270
+
249 271
 .. class:: django.views.generic.dates.DateDetailView
250 272
 
251 273
     A page representing an individual object. If the object has a date value in
10  docs/ref/class-based-views/generic-display.txt
@@ -5,6 +5,9 @@ Generic display views
5 5
 The two following generic class-based views are designed to display data. On
6 6
 many projects they are typically the most commonly used views.
7 7
 
  8
+DetailView
  9
+----------
  10
+
8 11
 .. class:: django.views.generic.detail.DetailView
9 12
 
10 13
     While this view is executing, ``self.object`` will contain the object that
@@ -39,7 +42,7 @@ many projects they are typically the most commonly used views.
39 42
         from articles.models import Article
40 43
 
41 44
         class ArticleDetailView(DetailView):
42  
-        
  45
+
43 46
             model = Article
44 47
 
45 48
             def get_context_data(self, **kwargs):
@@ -55,7 +58,10 @@ many projects they are typically the most commonly used views.
55 58
 
56 59
         urlpatterns = patterns('',
57 60
             url(r'^(?P<slug>[-_\w]+)/$', ArticleDetailView.as_view(), name='article-detail'),
58  
-        )    
  61
+        )
  62
+
  63
+ListView
  64
+--------
59 65
 
60 66
 .. class:: django.views.generic.list.ListView
61 67
 
27  docs/ref/class-based-views/generic-editing.txt
@@ -2,7 +2,7 @@
2 2
 Generic editing views
3 3
 =====================
4 4
 
5  
-The following views are described on this page and provide a foundation for 
  5
+The following views are described on this page and provide a foundation for
6 6
 editing content:
7 7
 
8 8
 * :class:`django.views.generic.edit.FormView`
@@ -13,7 +13,7 @@ editing content:
13 13
 .. note::
14 14
 
15 15
     Some of the examples on this page assume that a model titled 'Author'
16  
-    has been defined. For these cases we assume the following has been defined 
  16
+    has been defined. For these cases we assume the following has been defined
17 17
     in `myapp/models.py`::
18 18
 
19 19
         from django import models
@@ -25,6 +25,9 @@ editing content:
25 25
             def get_absolute_url(self):
26 26
                 return reverse('author-detail', kwargs={'pk': self.pk})
27 27
 
  28
+FormView
  29
+--------
  30
+
28 31
 .. class:: django.views.generic.edit.FormView
29 32
 
30 33
     A view that displays a form. On error, redisplays the form with validation
@@ -69,6 +72,8 @@ editing content:
69 72
                 form.send_email()
70 73
                 return super(ContactView, self).form_valid(form)
71 74
 
  75
+CreateView
  76
+----------
72 77
 
73 78
 .. class:: django.views.generic.edit.CreateView
74 79
 
@@ -94,7 +99,7 @@ editing content:
94 99
     .. attribute:: template_name_suffix
95 100
 
96 101
         The CreateView page displayed to a GET request uses a
97  
-        ``template_name_suffix`` of ``'_form.html'``. For 
  102
+        ``template_name_suffix`` of ``'_form.html'``. For
98 103
         example, changing this attribute to ``'_create_form.html'`` for a view
99 104
         creating objects for the the example `Author` model would cause the the
100 105
         default `template_name` to be ``'myapp/author_create_form.html'``.
@@ -107,6 +112,9 @@ editing content:
107 112
         class AuthorCreate(CreateView):
108 113
             model = Author
109 114
 
  115
+UpdateView
  116
+----------
  117
+
110 118
 .. class:: django.views.generic.edit.UpdateView
111 119
 
112 120
     A view that displays a form for editing an existing object, redisplaying
@@ -133,10 +141,10 @@ editing content:
133 141
     .. attribute:: template_name_suffix
134 142
 
135 143
         The UpdateView page displayed to a GET request uses a
136  
-        ``template_name_suffix`` of ``'_form.html'``. For 
  144
+        ``template_name_suffix`` of ``'_form.html'``. For
137 145
         example, changing this attribute to ``'_update_form.html'`` for a view
138 146
         updating objects for the the example `Author` model would cause the the
139  
-        default `template_name` to be ``'myapp/author_update_form.html'``.        
  147
+        default `template_name` to be ``'myapp/author_update_form.html'``.
140 148
 
141 149
     **Example views.py**::
142 150
 
@@ -146,6 +154,9 @@ editing content:
146 154
         class AuthorUpdate(UpdateView):
147 155
             model = Author
148 156
 
  157
+DeleteView
  158
+----------
  159
+
149 160
 .. class:: django.views.generic.edit.DeleteView
150 161
 
151 162
     A view that displays a confirmation page and deletes an existing object.
@@ -171,10 +182,10 @@ editing content:
171 182
     .. attribute:: template_name_suffix
172 183
 
173 184
         The DeleteView page displayed to a GET request uses a
174  
-        ``template_name_suffix`` of ``'_confirm_delete.html'``. For 
  185
+        ``template_name_suffix`` of ``'_confirm_delete.html'``. For
175 186
         example, changing this attribute to ``'_check_delete.html'`` for a view
176 187
         deleting objects for the the example `Author` model would cause the the
177  
-        default `template_name` to be ``'myapp/author_check_delete.html'``.        
  188
+        default `template_name` to be ``'myapp/author_check_delete.html'``.
178 189
 
179 190
 
180 191
     **Example views.py**::
@@ -185,4 +196,4 @@ editing content:
185 196
 
186 197
         class AuthorDelete(DeleteView):
187 198
             model = Author
188  
-            success_url = reverse_lazy('author-list')        
  199
+            success_url = reverse_lazy('author-list')
2  docs/ref/class-based-views/index.txt
@@ -6,7 +6,7 @@ Class-based views API reference. For introductory material, see
6 6
 :doc:`/topics/class-based-views/index`.
7 7
 
8 8
 .. toctree::
9  
-   :maxdepth: 1
  9
+   :maxdepth: 3
10 10
 
11 11
    base
12 12
    generic-display
18  docs/ref/class-based-views/mixins-date-based.txt
@@ -3,6 +3,9 @@ Date-based mixins
3 3
 =================
4 4
 
5 5
 
  6
+YearMixin
  7
+---------
  8
+
6 9
 .. class:: django.views.generic.dates.YearMixin
7 10
 
8 11
     A mixin that can be used to retrieve and provide parsing information for a
@@ -36,6 +39,9 @@ Date-based mixins
36 39
 
37 40
         Raises a 404 if no valid year specification can be found.
38 41
 
  42
+MonthMixin
  43
+----------
  44
+
39 45
 .. class:: django.views.generic.dates.MonthMixin
40 46
 
41 47
     A mixin that can be used to retrieve and provide parsing information for a
@@ -82,6 +88,9 @@ Date-based mixins
82 88
         date provided. If ``allow_empty = False``, returns the previous month
83 89
         that contained data.
84 90
 
  91
+DayMixin
  92
+--------
  93
+
85 94
 .. class:: django.views.generic.dates.DayMixin
86 95
 
87 96
     A mixin that can be used to retrieve and provide parsing information for a
@@ -127,6 +136,9 @@ Date-based mixins
127 136
         Returns a date object containing the previous day. If
128 137
         ``allow_empty = False``, returns the previous day that contained data.
129 138
 
  139
+WeekMixin
  140
+---------
  141
+
130 142
 .. class:: django.views.generic.dates.WeekMixin
131 143
 
132 144
     A mixin that can be used to retrieve and provide parsing information for a
@@ -161,6 +173,9 @@ Date-based mixins
161 173
         Raises a 404 if no valid week specification can be found.
162 174
 
163 175
 
  176
+DateMixin
  177
+---------
  178
+
164 179
 .. class:: django.views.generic.dates.DateMixin
165 180
 
166 181
     A mixin class providing common behavior for all date-based views.
@@ -204,6 +219,9 @@ Date-based mixins
204 219
         is greater than the current date/time. Returns
205 220
         :attr:`DateMixin.allow_future` by default.
206 221
 
  222
+BaseDateListView
  223
+----------------
  224
+
207 225
 .. class:: django.views.generic.dates.BaseDateListView
208 226
 
209 227
     A base class that provides common behavior for all date-based views. There
14  docs/ref/class-based-views/mixins-editing.txt
@@ -14,6 +14,9 @@ The following mixins are used to construct Django's editing views:
14 14
     Examples of how these are combined into editing views can be found at
15 15
     the documentation on ``Generic editing views``.
16 16
 
  17
+FormMixin
  18
+---------
  19
+
17 20
 .. class:: django.views.generic.edit.FormMixin
18 21
 
19 22
     A mixin class that provides facilities for creating and displaying forms.
@@ -90,6 +93,9 @@ The following mixins are used to construct Django's editing views:
90 93
         :meth:`~django.views.generic.FormMixin.form_invalid`.
91 94
 
92 95
 
  96
+ModelFormMixin
  97
+--------------
  98
+
93 99
 .. class:: django.views.generic.edit.ModelFormMixin
94 100
 
95 101
     A form mixin that works on ModelForms, rather than a standalone form.
@@ -147,12 +153,16 @@ The following mixins are used to construct Django's editing views:
147 153
     .. method:: form_invalid()
148 154
 
149 155
         Renders a response, providing the invalid form as context.
150  
-            
  156
+
  157
+
  158
+ProcessFormView
  159
+---------------
  160
+
151 161
 .. class:: django.views.generic.edit.ProcessFormView
152 162
 
153 163
     A mixin that provides basic HTTP GET and POST workflow.
154 164
 
155  
-    .. note:: 
  165
+    .. note::
156 166
 
157 167
         This is named 'ProcessFormView' and inherits directly from
158 168
         :class:`django.views.generic.base.View`, but breaks if used
6  docs/ref/class-based-views/mixins-multiple-object.txt
@@ -2,6 +2,9 @@
2 2
 Multiple object mixins
3 3
 ======================
4 4
 
  5
+MultipleObjectMixin
  6
+-------------------
  7
+
5 8
 .. class:: django.views.generic.list.MultipleObjectMixin
6 9
 
7 10
     A mixin that can be used to display a list of objects.
@@ -148,6 +151,9 @@ Multiple object mixins
148 151
       this context variable will be ``None``.
149 152
 
150 153
 
  154
+MultipleObjectTemplateResponseMixin
  155
+-----------------------------------
  156
+
151 157
 .. class:: django.views.generic.list.MultipleObjectTemplateResponseMixin
152 158
 
153 159
     A mixin class that performs template-based response rendering for views
6  docs/ref/class-based-views/mixins-simple.txt
@@ -2,6 +2,9 @@
2 2
 Simple mixins
3 3
 =============
4 4
 
  5
+ContextMixin
  6
+------------
  7
+
5 8
 .. class:: django.views.generic.base.ContextMixin
6 9
 
7 10
     .. versionadded:: 1.5
@@ -17,6 +20,9 @@ Simple mixins
17 20
         Returns a dictionary representing the template context. The
18 21
         keyword arguments provided will make up the returned context.
19 22
 
  23
+TemplateResponseMixin
  24
+---------------------
  25
+
20 26
 .. class:: django.views.generic.base.TemplateResponseMixin
21 27
 
22 28
     Provides a mechanism to construct a
6  docs/ref/class-based-views/mixins-single-object.txt
@@ -2,6 +2,9 @@
2 2
 Single object mixins
3 3
 ====================
4 4
 
  5
+SingleObjectMixin
  6
+-----------------
  7
+
5 8
 .. class:: django.views.generic.detail.SingleObjectMixin
6 9
 
7 10
     Provides a mechanism for looking up an object associated with the
@@ -86,6 +89,9 @@ Single object mixins
86 89
       ``context_object_name`` is specified, that variable will also be
87 90
       set in the context, with the same value as ``object``.
88 91
 
  92
+SingleObjectTemplateResponseMixin
  93
+---------------------------------
  94
+
89 95
 .. class:: django.views.generic.detail.SingleObjectTemplateResponseMixin
90 96
 
91 97
     A mixin class that performs template-based response rendering for views
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.