Skip to content

Commit

Permalink
[1.3.X] Fixed django#17390 - Added a note to topics/auth.txt regardin…
Browse files Browse the repository at this point in the history
…g how to decorate class-based generic views; thanks zsiciarz for the patch.

Backport of r17564 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@17565 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
timgraham committed Feb 20, 2012
1 parent 4d95968 commit 4f6c364
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions docs/topics/auth.txt
Expand Up @@ -1174,9 +1174,16 @@ The permission_required decorator
Limiting access to generic views
--------------------------------

To limit access to a :doc:`generic view </ref/generic-views>`, write a thin
wrapper around the view, and point your URLconf to your wrapper instead of the
generic view itself. For example::
Controlling access to a :doc:`class-based generic view </ref/class-based-views>`
is done by decorating the :meth:`View.dispatch <django.views.generic.base.View.dispatch>`
method on the class. See :ref:`decorating-class-based-views` for the details.

Function-based generic views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To limit access to a :doc:`function-based generic view </ref/generic-views>`,
write a thin wrapper around the view, and point your URLconf to your wrapper
instead of the generic view itself. For example::

from django.views.generic.date_based import object_detail

Expand Down
2 changes: 2 additions & 0 deletions docs/topics/class-based-views.txt
Expand Up @@ -584,6 +584,8 @@ This approach applies the decorator on a per-instance basis. If you
want every instance of a view to be decorated, you need to take a
different approach.

.. _decorating-class-based-views:

Decorating the class
--------------------

Expand Down

0 comments on commit 4f6c364

Please sign in to comment.