1👍
✅
Typically, with RESTful APIs, this sort of thing is handled with content type negotiation. I haven’t used it, but Django REST framework can provide content negotiation.
0👍
Have a single function responsible for collating the info, and then two separate views responsible for calling the common function and either rendering a template or encoding as JSON.
- [Answer]-Django Context contains not defined field when using RequestContext
- [Answer]-Overriding save() method in Model. How to do this correctly?
- [Answer]-Get objects in query based on user
Source:stackexchange.com