mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Use context dict in HTMLRenderer
This commit is contained in:
parent
7cdedc0f71
commit
c221bc6f6f
|
@ -130,7 +130,7 @@ An example of a view that uses `HTMLRenderer`:
|
|||
|
||||
def get(self, request, *args, **kwargs)
|
||||
self.object = self.get_object()
|
||||
return Response(self.object, template_name='user_detail.html')
|
||||
return Response({'user': self.object}, template_name='user_detail.html')
|
||||
|
||||
You can use `HTMLRenderer` either to return regular HTML pages using REST framework, or to return both HTML and API responses from a single endpoint.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user