News for hackers. Stuff that matters.
Re:REST framework 2 released: Simple, beautiful, browsable W... by bmelton on Tuesday October 30, 2012 @04:23PM (#4719336)
I'm fairly entrenched with Tastypie at the moment, but I've always been jealous of REST Framework's "document at the endpoint" setup.

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.

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.

Re:REST framework 2 released: Simple, beautiful, browsable W... by bmelton on Tuesday October 30, 2012 @05:27PM (#4719749)
So obvious, I'm embarrassed I didn't think of it first.

Much thanks!