mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 10:03:57 +03:00
Merge pull request #1256 from minddust/fix_docs_sample
Fix TemplateHTMLRenderer example
This commit is contained in:
commit
01040b077c
|
@ -167,14 +167,14 @@ The template name is determined by (in order of preference):
|
||||||
|
|
||||||
An example of a view that uses `TemplateHTMLRenderer`:
|
An example of a view that uses `TemplateHTMLRenderer`:
|
||||||
|
|
||||||
class UserDetail(generics.RetrieveUserAPIView):
|
class UserDetail(generics.RetrieveAPIView):
|
||||||
"""
|
"""
|
||||||
A view that returns a templated HTML representations of a given user.
|
A view that returns a templated HTML representations of a given user.
|
||||||
"""
|
"""
|
||||||
queryset = User.objects.all()
|
queryset = User.objects.all()
|
||||||
renderer_classes = (TemplateHTMLRenderer,)
|
renderer_classes = (TemplateHTMLRenderer,)
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs)
|
def get(self, request, *args, **kwargs):
|
||||||
self.object = self.get_object()
|
self.object = self.get_object()
|
||||||
return Response({'user': self.object}, template_name='user_detail.html')
|
return Response({'user': self.object}, template_name='user_detail.html')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user