mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 01:47:59 +03:00 
			
		
		
		
	Fixed code example.
This commit is contained in:
		
							parent
							
								
									1bd8fe4152
								
							
						
					
					
						commit
						ab4be47379
					
				| 
						 | 
					@ -45,6 +45,9 @@ For example, given a method like this on the `UserViewSet` class:
 | 
				
			||||||
    from myapp.permissions import IsAdminOrIsSelf
 | 
					    from myapp.permissions import IsAdminOrIsSelf
 | 
				
			||||||
    from rest_framework.decorators import detail_route
 | 
					    from rest_framework.decorators import detail_route
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    class UserViewSet(ModelViewSet):
 | 
				
			||||||
 | 
					        ...
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        @detail_route(methods=['post'], permission_classes=[IsAdminOrIsSelf])
 | 
					        @detail_route(methods=['post'], permission_classes=[IsAdminOrIsSelf])
 | 
				
			||||||
        def set_password(self, request, pk=None):
 | 
					        def set_password(self, request, pk=None):
 | 
				
			||||||
            ...
 | 
					            ...
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user