#2553 closed enhancement (wontfix)
Generic views should support serialization
Reported by: | 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 |
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.
Change History (10)
comment:1 by , 18 years ago
comment:2 by , 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:5 by , 18 years ago
Triage Stage: | Unreviewed → 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?
comment:6 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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 , 18 years ago
Cc: | 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 , 16 years ago
Cc: | added |
---|---|
Resolution: | wontfix |
Status: | closed → reopened |
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 , 16 years ago
milestone: | → post-1.0 |
---|---|
Resolution: | → wontfix |
Status: | reopened → closed |
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.
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?