#11352: get_object/list_or_404 methods ----------------------------+----------------------------------------------- Reporter: cpharmston | Owner: nobody Status: new | Milestone: Component: Core framework | Version: SVN Keywords: | Stage: Unreviewed Has_patch: 1 | ----------------------------+----------------------------------------------- Hey all,
First time contributor (not just to Django, but to any open source project), so go easy on me. Several times I've found myself wanting for a get_list_or_none() shortcut method. get_list_or_404 is nice, but there are some instances (search results, for example) where returning an empty QuerySet makes much more sense. Attached is a patch adding functional get_list_or_404 and get_object_or_404 methods to django.shortcuts. I am aware that in #2659 Adrian rejected get_object_or_404 as scope creep, but since that time objects.none() has been introduced, which would render these methods much more useful. Feel free to set it as wontfix if you still think it's scope creep, but these are certainly useful methods for me, and I'm sure they would be for others as well. I have not run unit tests on this; it seems to me that it would make more sense to get community buy-in on the necessity for these methods first. Feedback welcome. Thanks all! -- Ticket URL: <http://code.djangoproject.com/ticket/11352> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---
