This is talking about HTTP responses, rather than fields, but I agree with
Adam here: you should be able to encapsulate overriding the default encoder
in a single location. It doesn't need a setting.

On Thu, 23 Jun 2022 at 23:57, 'Adam Johnson' via Django developers
(Contributions to Django itself) <django-developers@googlegroups.com> wrote:

> I don't think that's necessary, you can create a subclass of JSONField
> with the encoder you want, or even faster use functools.partial() as I
> blogged about here:
> https://adamj.eu/tech/2021/05/05/3-uses-for-functools-partial-in-django/#making-reusable-fields-without-subclassing
>
> On Thu, Jun 23, 2022 at 9:11 PM Steve Jorgensen <stevec...@gmail.com>
> wrote:
>
>> I think that seems like a good thing to be able to configure.
>>
>> On Thursday, June 23, 2022 at 7:54:56 AM UTC-7 Fab wrote:
>>
>>> Hey,
>>>
>>> With JsonResponse instead of the encoder defaulting to DjangoJSONEncoder
>>> I was thinking it would be nice to have a setting like DEFAULT_JSON_ENCODER
>>> so I can set another one if needed without having to change all my usages
>>> already set.
>>>
>>>
>>> https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/django/http/response.py#L676
>>>
>>> Is there any reason not to do this? Feels like it wont break backwards
>>> compatibility.
>>>
>>> Regards,
>>>
>>> Fab
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/0eff9638-f455-4a64-a507-b47c6bd2cff0n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-developers/0eff9638-f455-4a64-a507-b47c6bd2cff0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAMyDDM2DzWneRNCHk0psdinCehJmvw71PSw1Fh5RBfYcsZktww%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAMyDDM2DzWneRNCHk0psdinCehJmvw71PSw1Fh5RBfYcsZktww%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAJwKpyQq9Ou5n%3D%2BvgWZEeBLjBysuyN-ONFAvrNzkU57kJffUSQ%40mail.gmail.com.
  • Jso... Fab
    • ... Steve Jorgensen
      • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
        • ... Carlton Gibson

Reply via email to