Re: JsonResponse have a DEFAULT_JSON_ENCODER setting

2022-06-23 Thread Carlton Gibson
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

Re: JsonResponse have a DEFAULT_JSON_ENCODER setting

2022-06-23 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
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

Re: JsonResponse have a DEFAULT_JSON_ENCODER setting

2022-06-23 Thread Steve Jorgensen
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 se