Django

Code

Ticket #2553 (closed: wontfix)

Opened 2 years ago

Last modified 1 year ago

Generic views should support serialization

Reported by: James Bennett <ubernostrum@gmail.com> Assigned to: jacob
Milestone: Component: Generic views
Version: SVN Keywords:
Cc: telenieko@telenieko.com, john@sneeu.com Triage Stage: Design decision needed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Pretty much what the title says. Given that we have serializers for QuerySets?, and that we're shipping simplejson, it'd be nice if generic views could respond in formats other than HTML; perhaps an additional format keyword argument (defaulting to 'html') could be used to control this.

Attachments

Change History

08/16/06 23:51:45 changed by anonymous

Hi James. don't generic views take a template, and a mimetype already?

are you after a quick way to dump a queryset out? what about foreign keys, and 'protected' fields like passwords and API-keys.. would you want some kind of protection there?

08/17/06 10:24:02 changed by James Bennett <ubernostrum@gmail.com>

They do, but one of the great things about the serialization framework is that you don't have to do things like setting up a template to output JSON anymore -- Django can generate the output in the correct format for you automatically (also, it's probably safer to let Django do it this way -- libraries like simplejson reduce the risk of things blowing up due to a typo in a template).

10/23/06 04:49:25 changed by zenx

I agree with James, generic views returning xml or json would be great!

10/23/06 16:21:58 changed by Marc Fargas

  • cc set to telenieko@telenieko.com.

+1! addding me to CC

01/17/07 16:52:03 changed by mir@noris.de

  • stage changed from Unreviewed to Design decision needed.

Hi James--this looks as if you already have an idea how such a generic view would be used in code. Can you add it to the ticket, if you have?

01/30/07 16:46:35 changed by jacob

  • status changed from new to closed.
  • resolution set to wontfix.

I'd actually prefer *not* to tack this onto generic views, and instead create a REST-friendly Resource implementation similar to djangocollection. Accordingly I'm marking this wontfix, but anyone who wants to give a shot at RESTful-ness has my fondest blessing.

01/31/07 04:15:07 changed by john@sneeu.com

  • cc changed from telenieko@telenieko.com to telenieko@telenieko.com, john@sneeu.com.

I've written a RESTful API (similar urls to the 'oldforms' Admin), it needs a bit of a tidy up, and a few more tweaks but I'm more than happy for it to be incorporated in to Django in any way.


Add/Change #2553 (Generic views should support serialization)




Change Properties
Action