Opened 3 years ago

Last modified 3 years ago

#33384 closed New feature

Add get_or_none method — at Version 3

Reported by: MojixCoder Owned by: nobody
Component: Database layer (models, ORM) Version: 4.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by MojixCoder)

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, peewee, 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?

Change History (3)

comment:1 by MojixCoder, 3 years ago

Summary: Add `get_or_none` methodAdd get_or_none method

comment:2 by MojixCoder, 3 years ago

Description: modified (diff)

comment:3 by MojixCoder, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top