mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +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)
|
def get(self, request, *args, **kwargs)
|
||||||
self.object = self.get_object()
|
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.
|
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