Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.3.X] Fixed #15715 -- added non-trivial decorator example to CBV do…

…cs. Thanks toofishes.

Backport of r16534 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16535 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c828cc1ba62d9a4ebc144a081fff44c60d339e3a 1 parent 00886df
Simon Meers DrMeers authored

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. +5 2 docs/topics/class-based-views.txt
7 docs/topics/class-based-views.txt
@@ -570,11 +570,14 @@ result of the :meth:`~django.views.generic.base.View.as_view` method.
570 570 The easiest place to do this is in the URLconf where you deploy your
571 571 view::
572 572
573   - from django.contrib.auth.decorators import login_required
  573 + from django.contrib.auth.decorators import login_required, permission_required
574 574 from django.views.generic import TemplateView
575 575
  576 + from .views import VoteView
  577 +
576 578 urlpatterns = patterns('',
577   - (r'^about/',login_required(TemplateView.as_view(template_name="secret.html"))),
  579 + (r'^about/', login_required(TemplateView.as_view(template_name="secret.html"))),
  580 + (r'^vote/', permission_required('polls.can_vote')(VoteView.as_view())),
578 581 )
579 582
580 583 This approach applies the decorator on a per-instance basis. If you

0 comments on commit c828cc1

Please sign in to comment.
Something went wrong with that request. Please try again.