Here is a real-world example I found on a quick search:
https://github.com/dimagi/commcare-hq/blob/6be7be39cb3f554670685e811a15720d46cc4a2d/settings.py#L192
On Fri, Jun 24, 2022 at 11:00 PM Francisco Couzo
wrote:
> If you happen to be using pytest and want to detect if you're testing,
> there's
If you happen to be using pytest and want to detect if you're testing,
there's a really bad recommendation on this ticket:
https://github.com/pytest-dev/pytest-django/issues/333, now that alone
works, but if you were to import pytest, you would be running some test
settings and be none the wiser.
I am completely agree with Jörg.
Simply Mixin with own get_or_none help solve you, @Dave Gaeddert your asks.
Here we have Other big issue, which always omitted between Django developers in
GET method:
Multiple objects exception without Already received objects.
Get made "len", len created on
@Dave Gaeddert
Since you mentioned it - what should a get_or_none method do about
multiple objects? Still raise? Silently "cast" to None (imho
semantically wrong)? Return the underlying queryset (or any other
"multiple objects container thingy")?
The problem with .get() is - it may end in 3 d