mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Merge pull request #680 from dbrgn/docs_userdetail
Renamed UserInstance to UserDetail in docs
This commit is contained in:
		
						commit
						f00425c901
					
				| 
						 | 
				
			
			@ -123,7 +123,7 @@ The template name is determined by (in order of preference):
 | 
			
		|||
 | 
			
		||||
An example of a view that uses `TemplateHTMLRenderer`:
 | 
			
		||||
 | 
			
		||||
    class UserInstance(generics.RetrieveUserAPIView):
 | 
			
		||||
    class UserDetail(generics.RetrieveUserAPIView):
 | 
			
		||||
        """
 | 
			
		||||
        A view that returns a templated HTML representations of a given user.
 | 
			
		||||
        """
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -72,14 +72,14 @@ We'll also add a couple of views.  We'd like to just use read-only views for the
 | 
			
		|||
        serializer_class = UserSerializer
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    class UserInstance(generics.RetrieveAPIView):
 | 
			
		||||
    class UserDetail(generics.RetrieveAPIView):
 | 
			
		||||
        model = User
 | 
			
		||||
        serializer_class = UserSerializer
 | 
			
		||||
 | 
			
		||||
Finally we need to add those views into the API, by referencing them from the URL conf.
 | 
			
		||||
 | 
			
		||||
    url(r'^users/$', views.UserList.as_view()),
 | 
			
		||||
    url(r'^users/(?P<pk>[0-9]+)/$', views.UserInstance.as_view()),
 | 
			
		||||
    url(r'^users/(?P<pk>[0-9]+)/$', views.UserDetail.as_view()),
 | 
			
		||||
 | 
			
		||||
## Associating Snippets with Users
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -123,7 +123,7 @@ After adding all those names into our URLconf, our final `'urls.py'` file should
 | 
			
		|||
            views.UserList.as_view(),
 | 
			
		||||
            name='user-list'),
 | 
			
		||||
        url(r'^users/(?P<pk>[0-9]+)/$',
 | 
			
		||||
            views.UserInstance.as_view(),
 | 
			
		||||
            views.UserDetail.as_view(),
 | 
			
		||||
            name='user-detail')
 | 
			
		||||
    ))
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user