mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 18:08:03 +03:00 
			
		
		
		
	Fix on documentation - wrong reference at previous created view UserList / UserDetail
This commit is contained in:
		
							parent
							
								
									f1251e8c58
								
							
						
					
					
						commit
						ffdf633aa5
					
				| 
						 | 
				
			
			@ -10,7 +10,9 @@ A `ViewSet` class is only bound to a set of method handlers at the last moment,
 | 
			
		|||
 | 
			
		||||
Let's take our current set of views, and refactor them into view sets.
 | 
			
		||||
 | 
			
		||||
First of all let's refactor our `UserListView` and `UserDetailView` views into a single `UserViewSet`.  We can remove the two views, and replace then with a single class:
 | 
			
		||||
First of all let's refactor our `UserList` and `UserDetail` views into a single `UserViewSet`.  We can remove the two views, and replace then with a single class:
 | 
			
		||||
 | 
			
		||||
    from rest_framework import viewsets
 | 
			
		||||
 | 
			
		||||
    class UserViewSet(viewsets.ReadOnlyModelViewSet):
 | 
			
		||||
        """
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +25,6 @@ Here we've used `ReadOnlyModelViewSet` class to automatically provide the defaul
 | 
			
		|||
 | 
			
		||||
Next we're going to replace the `SnippetList`, `SnippetDetail` and `SnippetHighlight` view classes.  We can remove the three views, and again replace them with a single class.
 | 
			
		||||
 | 
			
		||||
    from rest_framework import viewsets
 | 
			
		||||
    from rest_framework.decorators import link
 | 
			
		||||
 | 
			
		||||
    class SnippetViewSet(viewsets.ModelViewSet):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user