Opened 18 months ago
Closed 18 months ago
#34683 closed Cleanup/optimization (wontfix)
get_object_or_404 and get_list_or_404 custom messaging
Reported by: | Emanuel | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | 4.2 |
Severity: | Normal | Keywords: | HTTP 404 |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Is there a possibility to add a message parameter to get_object_or_404 and get_list_or_404? This function is lovely and reduces boilerplate a lot. In the view that I'm currently using it, I have business logic that depends on finding other models first, and having a message should be excellent since the lack of a message parameter sends me back to using try-catch or if-None statements.
I know there might be another design or security feature as well but the gain in my code would be significant.
Thanks for this ticket, however we don't want to complicate this shortcuts. You can always add a small wrapper in your app, e.g.