mirror of
				https://github.com/django/django.git
				synced 2025-10-26 07:06:08 +00:00 
			
		
		
		
	Fixed #15715 -- added non-trivial decorator example to CBV docs. Thanks toofishes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16534 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -570,11 +570,14 @@ result of the :meth:`~django.views.generic.base.View.as_view` method. | ||||
| 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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user