Opened 18 years ago

Closed 16 years ago

Last modified 15 years ago

#2553 closed enhancement (wontfix)

Generic views should support serialization

Reported by: James Bennett <ubernostrum@…> Owned by: Jacob
Component: Generic views Version: dev
Severity: normal Keywords:
Cc: telenieko@…, john@…, jgelens@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


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.

Change History (10)

comment:1 by anonymous, 18 years ago

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?

comment:2 by James Bennett <ubernostrum@…>, 18 years ago

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).

comment:3 by zenx, 18 years ago

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

comment:4 by Marc Fargas, 18 years ago

Cc: telenieko@… added

+1! addding me to CC

comment:5 by mir@…, 17 years ago

Triage Stage: UnreviewedDesign 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?

comment:6 by Jacob, 17 years ago

Resolution: wontfix
Status: newclosed

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.

comment:7 by john@…, 17 years ago

Cc: john@… added

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.

comment:8 by Jeffrey Gelens, 16 years ago

Cc: jgelens@… added
Resolution: wontfix
Status: closedreopened

I'm about to implement a serialization option in generic views for my own application. Since there was no effort on the REST-friendly implementation for django-trunk, I would like upload the patch when it's done. Anyway against this?

comment:9 by Michael Radziej, 16 years ago

milestone: post-1.0
Resolution: wontfix
Status: reopenedclosed

No worries if you just want to upload the patch, that's fine. But the ticket has been resolved as "wontfix", i.e. the patch won't be integrated into django.

You should not reopen such a ticket. If you want to discuss Jacob's decision, the usual process is to post an email to django-developers.

You probably better try to roll your patch into a normal django application, if possible.

comment:10 by (none), 15 years ago

milestone: post-1.0

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top