Ticket #15730: 15730.diff

File 15730.diff, 2.1 KB (added by timo, 3 years ago)

Add doc method for View.as_view

  • 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 3f82b44..3e869f7 100644
    a b View 
    1818
    1919    **Method Flowchart**
    2020
    21     1. :meth:`dispatch()`
    22     2. :meth:`http_method_not_allowed()`
     21    1. :meth:`as_view()`
     22    2. :meth:`dispatch()`
     23    3. :meth:`http_method_not_allowed()`
    2324
    2425    **Example views.py**::
    2526
    View 
    4344
    4445    **Methods**
    4546
     47    .. method:: as_view(**initkwargs)
     48
     49        Returns a callable view that takes a request and returns a response::
     50
     51            response = MyView.as_view(request)
     52
    4653    .. method:: dispatch(request, *args, **kwargs)
    4754
    4855        The ``view`` part of the view -- the method that accepts a ``request``
  • 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 f0e7bbc..c4b6326 100644
    a b it is safe to store state variables on the instance (i.e., ``self.foo = 3`` is 
    2323a thread-safe operation).
    2424
    2525A class-based view is deployed into a URL pattern using the
    26 :meth:`~View.as_view()` classmethod::
     26:meth:`~django.views.generic.base.View.as_view()` classmethod::
    2727
    2828    urlpatterns = patterns('',
    2929        (r'^view/$', MyView.as_view(size=42)),
    A class-based view is deployed into a URL pattern using the 
    3737    is modified, the actions of one user visiting your view could have an
    3838    effect on subsequent users visiting the same view.
    3939
    40 Any argument passed into :meth:`~View.as_view()` will be assigned onto the
    41 instance that is used to service a request. Using the previous example,
    42 this means that every request on ``MyView`` is able to use ``self.size``.
     40Any argument passed into :meth:`~django.views.generic.base.View.as_view()` will
     41be assigned onto the instance that is used to service a request. Using the
     42previous example, this means that every request on ``MyView`` is able to use
     43``self.size``.
    4344
    4445Base vs Generic views
    4546---------------------
Back to Top