Ticket #15715: perm-reqd-example.patch
File perm-reqd-example.patch, 834 bytes (added by , 14 years ago) |
---|
-
docs/topics/class-based-views.txt
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 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