How can you use the same approach as the standard view way of rendering HTML templates? In the standard way you can do something like this:
from django.views.generic import TemplateView
class BaseView(TemplateView):
template_name = 'something.html'
def get_context_data(self, **kwargs):
context = super(BaseView, self).get_context_data(**kwargs)
context['body'] = 'lorem ipsum'
return contextCan you have an APIView class with template_name set to something like 'something.json'? And then .json template file will have some context placeholders like {{ blah }}. But this class will still respond with json as the output, and you can also set format=json so that you can access the url with the .json extension. My default renderer class is rest_framework.renderers.JSONRenderer
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.