Opened 4 years ago
Last modified 4 years ago
#33384 closed New feature
Add get_or_none method — at Version 2
| 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 )
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?
Change History (2)
comment:1 by , 4 years ago
| Summary: | Add `get_or_none` method → Add get_or_none method |
|---|
comment:2 by , 4 years ago
| Description: | modified (diff) |
|---|
Note:
See TracTickets
for help on using tickets.