Hi,
Since your proposal can live easily out of Django core as a 3rd party
functionality you should start by implementing it, rather than waiting
for official green light.
And that as said, since it can live very easily outside of Django you
should really convince that this is something worth of including in the
core. Or is there something that can't be done without changing Django
internals?
On 6.9.2017 17.32, Ryan Fredericks wrote:
Hello everyone,
My name is Ryan and I've had the pleasure of working on various Django
backed projects for the last three or four years. I've never
contributed to the project (yet) but I'd like to get started. I'm
posting today because I'd like to discuss something that has irked me
about JsonResponse for a while. I would love to submit a new PR for
the feature I'm about to describe, but I just wanted to run it by you
all and hear some thoughts first.
Currently Django can grab data as QuerySets. Those QuerySets are
easily serializable as json (or xml or whatever) via
django.core.serializers. Since it is so easy to serialize a QuerySet
as json, wouldn't it follow that JsonResponse could handle a QuerySet?
Currently it does not, which leaves the following 2 workarounds: 1)
manually set the content-type header in an HttpResponse, or 2) write
some sort of crazy class that extends the json dumps encoder and pass
that through to JsonResponse. I know its not a huge deal, but how
would you guys feel about either:
A - detecting if the object passed to JsonResponse is a QuerySet and
then serializing it appropriately using the built in Django serializer
instead of json dumps
B - Providing that json dumps encoder class to allow people to simply
include that when they want to pass in a QuerySet to a JsonResponse.
I'd be happy to write something up and submit a PR if you guys think
its worth it/a good place to start contributing.
Here's to hoping I can help contribute to many (much more) cool things
in the future,
Ryan
--
You received this message because you are subscribed to the Google
Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-developers+unsubscr...@googlegroups.com
<mailto:django-developers+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-developers@googlegroups.com
<mailto:django-developers@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/01c11ccd-6017-44e4-b31a-0f5bb08b386d%40googlegroups.com
<https://groups.google.com/d/msgid/django-developers/01c11ccd-6017-44e4-b31a-0f5bb08b386d%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
Jani Tiainen
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/19fecb64-6a3a-ba57-5654-9a8c1718a34a%40gmail.com.
For more options, visit https://groups.google.com/d/optout.