Re:REST framework 2 released: Simple, beautiful, browsable W...
by tomchristie on Tuesday October 30, 2012 @04:31PM
(#4719387)
It uses the client's 'Accept:' header which specifies which media types it prefers for the response (eg. 'text/html', 'application/json')
Browsers will indicate that they prefer HTML, so that's what REST framework serves them.
Can I ask how you're determining whether or not the client is making an API call vs visiting the page directly? It'd be great to be able to supply Document templates that surface like REST Framework does, but I can't make out whether you're checking the client, the action, the protocol or something altogether different.