Opened 10 years ago
Closed 10 years ago
#23500 closed New feature (worksforme)
Allow get_object_or_404 to accept select_related and prefetch_related
Description ¶
get_object_or_404 is a nice helper, but it doesn't support select_related and prefetch_related. At my company, we've had to implement that ourselves, but it would be great if Django had support for those to begin with.
I will totally be willing to create the patch myself, but I want to figure out whether there is support for this improvement. Please let me know if you approve of this change.
Note:
See TracTickets
for help on using tickets.
The first argument to
get_object_or_404
can be a model or manager or query set; therefore it supports all query set methods.