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

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,

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

Re: Idea: Add .checked(/) to QuerySet as alternative to .filter() w/ .first()

2022-06-23 Thread Dave Gaeddert
I'll lob in my 2 cents that I actually think `get_or_none` would be great to have, in the same way that I imagine people think `get_or_create` is useful. You can try/catch yourself in both cases (example is basically the exact same

JsonResponse have a DEFAULT_JSON_ENCODER setting

2022-06-23 Thread Fab
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.

Feature Idea: extend dumpdata command with django-filters

2022-06-23 Thread Diego Margoni
I recently had the need to dump a huge table using the Django dumpdata command but I only needed a subset of records base on some standard filter. I think there is already an external package for this, but for basic filtering I think it would be useful to have it integrated in Django simply