Currently we have get_object_or_404 and get_list_or_404 but sometimes we just want to get first matching record for some criteria. If criteria aren't unique then get_object_or_404 raises MultipleObjectsReturned so request ends with internal server error.
My idea is to add function which returns just first matching element and ends with 404 if no elements match. This function will have parameter order_by (optional or required) of type List['str'] which determines which element choose first if there are many matching elements. In my opinion addition of this feature is good idea, because it is useful and safe for Django framework. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/e26f77f1-984a-453a-998e-32deec8c64d7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.