Opened 16 months ago
Closed 16 months ago
#34715 closed New feature (duplicate)
have proposal to create new orm method get_object_or_none same as get_object_or_404
Reported by: | Mahavir Agrawal | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 4.2 |
Severity: | Normal | Keywords: | django orm |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
I would like to propose a new method called get_object_or_none, which would return an object if it exists, and None otherwise. This functionality is often desired by developers, as it eliminates the need to use try-except blocks and simplifies the code where developer wants object if exist otherwise None.
Change History (3)
comment:1 by , 16 months ago
Description: | modified (diff) |
---|
comment:2 by , 16 months ago
Description: | modified (diff) |
---|
comment:3 by , 16 months ago
Has patch: | unset |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #2659.