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
https://docs.djangoproject.com/en/4.0/ref/models/querysets/#get
> To begin with - thats the place I dont like .get() at all. The fact that
> it might end up with multiple objects is a nuisance, but we cannot do
> much about it for API compat reasons
> ...
For what it's worth, I agree with what you're saying here too. Having a
`unique_or_none` (and maybe `uniq
years... seems like this could be reconsidered.
On Tuesday, June 28, 2022 at 9:27:52 AM UTC-5 Dave Gaeddert wrote:
> > To begin with - thats the place I dont like .get() at all. The fact that
> > it might end up with multiple objects is a nuisance, but we cannot do
> > much
Hey Mariusz, thanks for the link — I found some other threads but not that
one. Would you mind saying why you're personally against it (`get_or_none`
specifically)?
At least how I read that thread, there was more debate about how to add it
than whether to add it at all, and then Cal sort of "ga
Fair enough. To me, the `get_or_none` behavior with multiple results would
still be to raise an exception (so it is just like `get` in that sense).
And that’s the reason I personally don’t just see it as a shortcut for
`filter().first()` — I have (as I’m sure others have) made the mistake
befor
; Manager, "
> "or QuerySet, not '%s'." % klass__name
> )
> try:
> return queryset.get(*args, **kwargs)
> except queryset.model.DoesNotExist:
> return None
>
>
>
> On Sun, Jul 10, 2022 at 10:13 PM Dave Gaedder
I'll drop it. Someone else can chime in if they want. Just to be clear, the
work you all do on Django is much appreciated :)
Thanks,
Dave
On Thursday, July 14, 2022 at 6:53:41 PM UTC-5 James Bennett wrote:
> On Thu, Jul 14, 2022 at 4:09 PM Dave Gaeddert wrote:
>
>> Yeah, I ho