Author: DrMeers Date: 2011-07-10 14:40:14 -0700 (Sun, 10 Jul 2011) New Revision: 16535
Modified: django/branches/releases/1.3.X/docs/topics/class-based-views.txt Log: [1.3.X] Fixed #15715 -- added non-trivial decorator example to CBV docs. Thanks toofishes. Backport of r16534 from trunk. Modified: django/branches/releases/1.3.X/docs/topics/class-based-views.txt =================================================================== --- django/branches/releases/1.3.X/docs/topics/class-based-views.txt 2011-07-10 21:39:18 UTC (rev 16534) +++ django/branches/releases/1.3.X/docs/topics/class-based-views.txt 2011-07-10 21:40:14 UTC (rev 16535) @@ -570,11 +570,14 @@ The easiest place to do this is in the URLconf where you deploy your view:: - from django.contrib.auth.decorators import login_required + from django.contrib.auth.decorators import login_required, permission_required from django.views.generic import TemplateView + from .views import VoteView + urlpatterns = patterns('', - (r'^about/',login_required(TemplateView.as_view(template_name="secret.html"))), + (r'^about/', login_required(TemplateView.as_view(template_name="secret.html"))), + (r'^vote/', permission_required('polls.can_vote')(VoteView.as_view())), ) This approach applies the decorator on a per-instance basis. If you -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.