diff options
| author | Tim Graham <timograham@gmail.com> | 2012-09-08 13:19:58 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2012-09-08 13:19:58 -0400 |
| commit | b139cfc0f7e70e37b9a31e9931c6b03b8a68e918 (patch) | |
| tree | eb8ef6247b0b712eba8f94cdb99a6640c59d901d /docs | |
| parent | 3c27344b45d6ae249c39e602556f2f7483df1403 (diff) | |
Fixed #15730 - Documented the as_view() method for CBVs.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/class-based-views/base.txt | 6 | ||||
| -rw-r--r-- | docs/ref/class-based-views/index.txt | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/docs/ref/class-based-views/base.txt b/docs/ref/class-based-views/base.txt index 3f82b44f46..42448ebc80 100644 --- a/docs/ref/class-based-views/base.txt +++ b/docs/ref/class-based-views/base.txt @@ -43,6 +43,12 @@ View **Methods** + .. classmethod:: as_view(**initkwargs) + + Returns a callable view that takes a request and returns a response:: + + response = MyView.as_view(request) + .. method:: dispatch(request, *args, **kwargs) The ``view`` part of the view -- the method that accepts a ``request`` diff --git a/docs/ref/class-based-views/index.txt b/docs/ref/class-based-views/index.txt index f0e7bbc6c1..c4b632604a 100644 --- a/docs/ref/class-based-views/index.txt +++ b/docs/ref/class-based-views/index.txt @@ -23,7 +23,7 @@ it is safe to store state variables on the instance (i.e., ``self.foo = 3`` is a thread-safe operation). A class-based view is deployed into a URL pattern using the -:meth:`~View.as_view()` classmethod:: +:meth:`~django.views.generic.base.View.as_view()` classmethod:: urlpatterns = patterns('', (r'^view/$', MyView.as_view(size=42)), @@ -37,9 +37,10 @@ A class-based view is deployed into a URL pattern using the is modified, the actions of one user visiting your view could have an effect on subsequent users visiting the same view. -Any argument passed into :meth:`~View.as_view()` will be assigned onto the -instance that is used to service a request. Using the previous example, -this means that every request on ``MyView`` is able to use ``self.size``. +Any argument passed into :meth:`~django.views.generic.base.View.as_view()` will +be assigned onto the instance that is used to service a request. Using the +previous example, this means that every request on ``MyView`` is able to use +``self.size``. Base vs Generic views --------------------- |
