Ticket #18752: 261.diff

File 261.diff, 17.3 KB (added by Issac Kelly, 12 years ago)
  • docs/ref/class-based-views/base.txt

    diff --git a/docs/ref/class-based-views/base.txt b/docs/ref/class-based-views/base.txt
    index 5e0360c..3f82b44 100644
    a b themselves or inherited from. They may not provide all the capabilities  
    88required for projects, in which case there are Mixins and Generic class-based
    99views.
    1010
     11View
     12----
     13
    1114.. class:: django.views.generic.base.View
    1215
    1316    The master class-based base view. All other class-based views inherit from
    views.  
    3134    **Example urls.py**::
    3235
    3336        from django.conf.urls import patterns, url
    34        
     37
    3538        from myapp.views import MyView
    36        
     39
    3740        urlpatterns = patterns('',
    3841            url(r'^mine/$', MyView.as_view(), name='my-view'),
    3942        )
    40        
     43
    4144    **Methods**
    4245
    4346    .. method:: dispatch(request, *args, **kwargs)
    views.  
    6164
    6265        The default implementation returns ``HttpResponseNotAllowed`` with list
    6366        of allowed methods in plain text.
    64        
    65     .. note:: 
     67
     68    .. note::
    6669
    6770        Documentation on class-based views is a work in progress. As yet, only the
    6871        methods defined directly on the class are documented here, not methods
    6972        defined on superclasses.
    7073
     74TemplateView
     75------------
     76
    7177.. class:: django.views.generic.base.TemplateView
    7278
    7379    Renders a given template, passing it a ``{{ params }}`` template variable,
    views.  
    8490    1. :meth:`dispatch()`
    8591    2. :meth:`http_method_not_allowed()`
    8692    3. :meth:`get_context_data()`
    87      
     93
    8894    **Example views.py**::
    8995
    9096        from django.views.generic.base import TemplateView
    91        
     97
    9298        from articles.models import Article
    9399
    94100        class HomePageView(TemplateView):
    95101
    96102            template_name = "home.html"
    97            
     103
    98104            def get_context_data(self, **kwargs):
    99105                context = super(HomePageView, self).get_context_data(**kwargs)
    100106                context['latest_articles'] = Article.objects.all()[:5]
    101107                return context
    102                
     108
    103109    **Example urls.py**::
    104110
    105111        from django.conf.urls import patterns, url
    views.  
    126132    * ``params``: The dictionary of keyword arguments captured from the URL
    127133      pattern that served the view.
    128134
    129     .. note:: 
     135    .. note::
    130136
    131137        Documentation on class-based views is a work in progress. As yet, only the
    132138        methods defined directly on the class are documented here, not methods
    133139        defined on superclasses.
    134140
     141RedirectView
     142------------
     143
    135144.. class:: django.views.generic.base.RedirectView
    136145
    137146    Redirects to a given URL.
    views.  
    159168
    160169        from django.shortcuts import get_object_or_404
    161170        from django.views.generic.base import RedirectView
    162        
     171
    163172        from articles.models import Article
    164173
    165174        class ArticleCounterRedirectView(RedirectView):
    views.  
    176185
    177186        from django.conf.urls import patterns, url
    178187        from django.views.generic.base import RedirectView
    179        
     188
    180189        from article.views import ArticleCounterRedirectView
    181190
    182191        urlpatterns = patterns('',
    views.  
    217226        behavior they wish, as long as the method returns a redirect-ready URL
    218227        string.
    219228
    220     .. note:: 
     229    .. note::
    221230
    222231        Documentation on class-based views is a work in progress. As yet, only the
    223232        methods defined directly on the class are documented here, not methods
  • docs/ref/class-based-views/generic-date-based.txt

    diff --git a/docs/ref/class-based-views/generic-date-based.txt b/docs/ref/class-based-views/generic-date-based.txt
    index 69a98df..6730923 100644
    a b Generic date views  
    55Date-based generic views (in the module :mod:`django.views.generic.dates`)
    66are views for displaying drilldown pages for date-based data.
    77
     8ArchiveIndexView
     9----------------
     10
    811.. class:: django.views.generic.dates.ArchiveIndexView
    912
    1013    A top-level index page showing the "latest" objects, by date. Objects with
    are views for displaying drilldown pages for date-based data.  
    2124    * :class:`django.views.generic.list.MultipleObjectMixin`
    2225    * :class:`django.views.generic.dates.DateMixin`
    2326    * :class:`django.views.generic.base.View`
    24    
     27
    2528    **Notes**
    2629
    2730    * Uses a default ``context_object_name`` of ``latest``.
    2831    * Uses a default ``template_name_suffix`` of ``_archive``.
    2932
     33YearArchiveView
     34---------------
     35
    3036.. class:: django.views.generic.dates.YearArchiveView
    3137
    3238    A yearly archive page showing all available months in a given year. Objects
    are views for displaying drilldown pages for date-based data.  
    8692
    8793    * Uses a default ``template_name_suffix`` of ``_archive_year``.
    8894
     95MonthArchiveView
     96----------------
     97
    8998.. class:: django.views.generic.dates.MonthArchiveView
    9099
    91100    A monthly archive page showing all objects in a given month. Objects with a
    are views for displaying drilldown pages for date-based data.  
    134143
    135144    * Uses a default ``template_name_suffix`` of ``_archive_month``.
    136145
     146WeekArchiveView
     147---------------
     148
    137149.. class:: django.views.generic.dates.WeekArchiveView
    138150
    139151    A weekly archive page showing all objects in a given week. Objects with a
    are views for displaying drilldown pages for date-based data.  
    175187
    176188    * Uses a default ``template_name_suffix`` of ``_archive_week``.
    177189
     190DayArchiveView
     191--------------
     192
    178193.. class:: django.views.generic.dates.DayArchiveView
    179194
    180195    A day archive page showing all objects in a given day. Days in the future
    are views for displaying drilldown pages for date-based data.  
    225240
    226241    * Uses a default ``template_name_suffix`` of ``_archive_day``.
    227242
     243TodayArchiveView
     244----------------
     245
    228246.. class:: django.views.generic.dates.TodayArchiveView
    229247
    230248    A day archive page showing all objects for *today*. This is exactly the
    are views for displaying drilldown pages for date-based data.  
    246264    * :class:`django.views.generic.dates.DateMixin`
    247265    * :class:`django.views.generic.base.View`
    248266
     267
     268DateDetailView
     269--------------
     270
    249271.. class:: django.views.generic.dates.DateDetailView
    250272
    251273    A page representing an individual object. If the object has a date value in
  • docs/ref/class-based-views/generic-display.txt

    diff --git a/docs/ref/class-based-views/generic-display.txt b/docs/ref/class-based-views/generic-display.txt
    index bbf0d4f..ef3bc17 100644
    a b Generic display views  
    55The two following generic class-based views are designed to display data. On
    66many projects they are typically the most commonly used views.
    77
     8DetailView
     9----------
     10
    811.. class:: django.views.generic.detail.DetailView
    912
    1013    While this view is executing, ``self.object`` will contain the object that
    many projects they are typically the most commonly used views.  
    3942        from articles.models import Article
    4043
    4144        class ArticleDetailView(DetailView):
    42        
     45
    4346            model = Article
    4447
    4548            def get_context_data(self, **kwargs):
    many projects they are typically the most commonly used views.  
    5558
    5659        urlpatterns = patterns('',
    5760            url(r'^(?P<slug>[-_\w]+)/$', ArticleDetailView.as_view(), name='article-detail'),
    58         )   
     61        )
     62
     63ListView
     64--------
    5965
    6066.. class:: django.views.generic.list.ListView
    6167
  • docs/ref/class-based-views/generic-editing.txt

    diff --git a/docs/ref/class-based-views/generic-editing.txt b/docs/ref/class-based-views/generic-editing.txt
    index a65a59b..2fac06e 100644
    a b  
    22Generic editing views
    33=====================
    44
    5 The following views are described on this page and provide a foundation for 
     5The following views are described on this page and provide a foundation for
    66editing content:
    77
    88* :class:`django.views.generic.edit.FormView`
    editing content:  
    1313.. note::
    1414
    1515    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
    1717    in `myapp/models.py`::
    1818
    1919        from django import models
    editing content:  
    2525            def get_absolute_url(self):
    2626                return reverse('author-detail', kwargs={'pk': self.pk})
    2727
     28FormView
     29--------
     30
    2831.. class:: django.views.generic.edit.FormView
    2932
    3033    A view that displays a form. On error, redisplays the form with validation
    editing content:  
    6972                form.send_email()
    7073                return super(ContactView, self).form_valid(form)
    7174
     75CreateView
     76----------
    7277
    7378.. class:: django.views.generic.edit.CreateView
    7479
    editing content:  
    9499    .. attribute:: template_name_suffix
    95100
    96101        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
    98103        example, changing this attribute to ``'_create_form.html'`` for a view
    99104        creating objects for the the example `Author` model would cause the the
    100105        default `template_name` to be ``'myapp/author_create_form.html'``.
    editing content:  
    107112        class AuthorCreate(CreateView):
    108113            model = Author
    109114
     115UpdateView
     116----------
     117
    110118.. class:: django.views.generic.edit.UpdateView
    111119
    112120    A view that displays a form for editing an existing object, redisplaying
    editing content:  
    133141    .. attribute:: template_name_suffix
    134142
    135143        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
    137145        example, changing this attribute to ``'_update_form.html'`` for a view
    138146        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'``.
    140148
    141149    **Example views.py**::
    142150
    editing content:  
    146154        class AuthorUpdate(UpdateView):
    147155            model = Author
    148156
     157DeleteView
     158----------
     159
    149160.. class:: django.views.generic.edit.DeleteView
    150161
    151162    A view that displays a confirmation page and deletes an existing object.
    editing content:  
    171182    .. attribute:: template_name_suffix
    172183
    173184        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
    175186        example, changing this attribute to ``'_check_delete.html'`` for a view
    176187        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'``.
    178189
    179190
    180191    **Example views.py**::
    editing content:  
    185196
    186197        class AuthorDelete(DeleteView):
    187198            model = Author
    188             success_url = reverse_lazy('author-list')       
     199            success_url = reverse_lazy('author-list')
  • docs/ref/class-based-views/index.txt

    diff --git a/docs/ref/class-based-views/index.txt b/docs/ref/class-based-views/index.txt
    index f2271d2..9ed0762 100644
    a b Class-based views API reference. For introductory material, see  
    66:doc:`/topics/class-based-views/index`.
    77
    88.. toctree::
    9    :maxdepth: 1
     9   :maxdepth: 3
    1010
    1111   base
    1212   generic-display
  • docs/ref/class-based-views/mixins-date-based.txt

    diff --git a/docs/ref/class-based-views/mixins-date-based.txt b/docs/ref/class-based-views/mixins-date-based.txt
    index a65471e..6bf6f10 100644
    a b Date-based mixins  
    33=================
    44
    55
     6YearMixin
     7---------
     8
    69.. class:: django.views.generic.dates.YearMixin
    710
    811    A mixin that can be used to retrieve and provide parsing information for a
    Date-based mixins  
    3639
    3740        Raises a 404 if no valid year specification can be found.
    3841
     42MonthMixin
     43----------
     44
    3945.. class:: django.views.generic.dates.MonthMixin
    4046
    4147    A mixin that can be used to retrieve and provide parsing information for a
    Date-based mixins  
    8288        date provided. If ``allow_empty = False``, returns the previous month
    8389        that contained data.
    8490
     91DayMixin
     92--------
     93
    8594.. class:: django.views.generic.dates.DayMixin
    8695
    8796    A mixin that can be used to retrieve and provide parsing information for a
    Date-based mixins  
    127136        Returns a date object containing the previous day. If
    128137        ``allow_empty = False``, returns the previous day that contained data.
    129138
     139WeekMixin
     140---------
     141
    130142.. class:: django.views.generic.dates.WeekMixin
    131143
    132144    A mixin that can be used to retrieve and provide parsing information for a
    Date-based mixins  
    161173        Raises a 404 if no valid week specification can be found.
    162174
    163175
     176DateMixin
     177---------
     178
    164179.. class:: django.views.generic.dates.DateMixin
    165180
    166181    A mixin class providing common behavior for all date-based views.
    Date-based mixins  
    204219        is greater than the current date/time. Returns
    205220        :attr:`DateMixin.allow_future` by default.
    206221
     222BaseDateListView
     223----------------
     224
    207225.. class:: django.views.generic.dates.BaseDateListView
    208226
    209227    A base class that provides common behavior for all date-based views. There
  • docs/ref/class-based-views/mixins-editing.txt

    diff --git a/docs/ref/class-based-views/mixins-editing.txt b/docs/ref/class-based-views/mixins-editing.txt
    index 8961088..95dd24f 100644
    a b The following mixins are used to construct Django's editing views:  
    1414    Examples of how these are combined into editing views can be found at
    1515    the documentation on ``Generic editing views``.
    1616
     17FormMixin
     18---------
     19
    1720.. class:: django.views.generic.edit.FormMixin
    1821
    1922    A mixin class that provides facilities for creating and displaying forms.
    The following mixins are used to construct Django's editing views:  
    9093        :meth:`~django.views.generic.FormMixin.form_invalid`.
    9194
    9295
     96ModelFormMixin
     97--------------
     98
    9399.. class:: django.views.generic.edit.ModelFormMixin
    94100
    95101    A form mixin that works on ModelForms, rather than a standalone form.
    The following mixins are used to construct Django's editing views:  
    147153    .. method:: form_invalid()
    148154
    149155        Renders a response, providing the invalid form as context.
    150            
     156
     157
     158ProcessFormView
     159---------------
     160
    151161.. class:: django.views.generic.edit.ProcessFormView
    152162
    153163    A mixin that provides basic HTTP GET and POST workflow.
    154164
    155     .. note:: 
     165    .. note::
    156166
    157167        This is named 'ProcessFormView' and inherits directly from
    158168        :class:`django.views.generic.base.View`, but breaks if used
  • docs/ref/class-based-views/mixins-multiple-object.txt

    diff --git a/docs/ref/class-based-views/mixins-multiple-object.txt b/docs/ref/class-based-views/mixins-multiple-object.txt
    index b414355..8bc613b 100644
    a b  
    22Multiple object mixins
    33======================
    44
     5MultipleObjectMixin
     6-------------------
     7
    58.. class:: django.views.generic.list.MultipleObjectMixin
    69
    710    A mixin that can be used to display a list of objects.
    Multiple object mixins  
    148151      this context variable will be ``None``.
    149152
    150153
     154MultipleObjectTemplateResponseMixin
     155-----------------------------------
     156
    151157.. class:: django.views.generic.list.MultipleObjectTemplateResponseMixin
    152158
    153159    A mixin class that performs template-based response rendering for views
  • docs/ref/class-based-views/mixins-simple.txt

    diff --git a/docs/ref/class-based-views/mixins-simple.txt b/docs/ref/class-based-views/mixins-simple.txt
    index 33d0db3..085c8a5 100644
    a b  
    22Simple mixins
    33=============
    44
     5ContextMixin
     6------------
     7
    58.. class:: django.views.generic.base.ContextMixin
    69
    710    .. versionadded:: 1.5
    Simple mixins  
    1720        Returns a dictionary representing the template context. The
    1821        keyword arguments provided will make up the returned context.
    1922
     23TemplateResponseMixin
     24---------------------
     25
    2026.. class:: django.views.generic.base.TemplateResponseMixin
    2127
    2228    Provides a mechanism to construct a
  • docs/ref/class-based-views/mixins-single-object.txt

    diff --git a/docs/ref/class-based-views/mixins-single-object.txt b/docs/ref/class-based-views/mixins-single-object.txt
    index a31608d..77f52b9 100644
    a b  
    22Single object mixins
    33====================
    44
     5SingleObjectMixin
     6-----------------
     7
    58.. class:: django.views.generic.detail.SingleObjectMixin
    69
    710    Provides a mechanism for looking up an object associated with the
    Single object mixins  
    8689      ``context_object_name`` is specified, that variable will also be
    8790      set in the context, with the same value as ``object``.
    8891
     92SingleObjectTemplateResponseMixin
     93---------------------------------
     94
    8995.. class:: django.views.generic.detail.SingleObjectTemplateResponseMixin
    9096
    9197    A mixin class that performs template-based response rendering for views
Back to Top