#33384: Add get_or_none method
-------------------------------+--------------------------------------
Reporter: MojixCoder | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by MojixCoder:
Old description:
> In Django we have `get` method for getting model objects.
> I have seen so many projects that implement `get_or_none` method in their
> projects.
> I know that we have `get_object_404` but sometimes we don't want to raise
> an exception.
> so I think `get_or_none` would be kinda useful, what do you think?
New description:
In Django we have `get` method for getting model objects.
I have seen so many projects that implement `get_or_none` method in their
projects.
There are also some python ORMs that have this feature for example
`tortoise-orm`, `ormar`, etc.
I know that we have `get_object_404` but sometimes we don't want to raise
an exception.
so I think `get_or_none` would be kinda useful, what do you think?
--
--
Ticket URL: <https://code.djangoproject.com/ticket/33384#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.c15df3ea2284c1340e97d1fdc053873f%40djangoproject.com.