This is related to this question: Django return json and html depending on client python
I have a command line Python API for a Django app. When I access the a
It looks like the Django REST framework uses the HTTP accept header in a Request in order to automatically determine which renderer to use:
http://www.django-rest-framework.org/api-guide/renderers/
Using the HTTP accept header may provide an alternative source for your "if something".