From 9e62428c2814358350ae715f0d51b4c7d4f258a0 Mon Sep 17 00:00:00 2001 From: Timo Graham Date: Mon, 20 Feb 2012 18:57:51 +0000 Subject: [PATCH] Fixed #17390 - Added a note to topics/auth.txt regarding how to decorate class-based generic views; thanks zsiciarz for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17564 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/topics/auth.txt | 13 ++++++++++--- docs/topics/class-based-views.txt | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index 1cfccfc5e02..3b6ad1b77df 100644 --- a/docs/topics/auth.txt +++ b/docs/topics/auth.txt @@ -1457,9 +1457,16 @@ The permission_required decorator Limiting access to generic views -------------------------------- -To limit access to a :doc:`generic view `, 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 ` +is done by decorating the :meth:`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 `, +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 diff --git a/docs/topics/class-based-views.txt b/docs/topics/class-based-views.txt index d375e8d67b1..81c59fed536 100644 --- a/docs/topics/class-based-views.txt +++ b/docs/topics/class-based-views.txt @@ -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 --------------------