Opened 12 years ago

Closed 12 years ago

#2659 closed enhancement (wontfix)

[patch] get_object_or_none shortcut

Reported by: Joeboy Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: master
Severity: normal Keywords:
Cc: django25@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I keep finding myself having to catch exceptions when I want to get an object if it exists and do something else if it doesn't. This patch provides a (hopefully) handy shortcut.

Attachments (1)

get_object_or_none.patch (650 bytes) - added by Joeboy 12 years ago.

Download all attachments as: .zip

Change History (2)

Changed 12 years ago by Joeboy

Attachment: get_object_or_none.patch added

comment:1 Changed 12 years ago by Adrian Holovaty

Resolution: wontfix
Status: newclosed

I'm marking this as a wontfix because it's a bit of feature creep. While I could see how this would be useful to some, this doesn't offer anything revolutionary, and people can just include the function in their own codebase if they find themselves needing it.

Note: See TracTickets for help on using tickets.
Back to Top