Re: Feature request: get_first_or_404

2017-11-30 Thread Robert Roskam
I'd like a better fleshed out example from OP, as it seems trivial to implement yourself whenever you need it. It may be that I'm not understanding the suggestion. On Wednesday, November 29, 2017 at 2:20:39 AM UTC-5, Sergey Fedoseev wrote: > > IMO it shouldn't be added to Django because the same

Re: Feature request: get_first_or_404

2017-11-28 Thread Sergey Fedoseev
IMO it shouldn't be added to Django because the same thing can be done in one line: get_object_or_404(qs[:1]), but we could add such using to get_object_or_404() docs. On Wednesday, November 29, 2017 at 3:41:54 AM UTC+5, Piotr DomaƄski wrote: > > Currently we have get_object_or_404 and get_list_

Re: Feature request: get_first_or_404

2017-11-28 Thread Collin Anderson
Is there a different between get_first_or_none() and the already existing first()? If we do first, some may want get_last_*() for everything too :) On Tue, Nov 28, 2017 at 8:31 PM, Josh Smeaton wrote: > From my experiences, all projects I've worked on have implemented > get_first_or_none and ge

Re: Feature request: get_first_or_404

2017-11-28 Thread Josh Smeaton
>From my experiences, all projects I've worked on have implemented get_first_or_none and get_first_or_404, and usually slightly differently. I think these shortcuts would make sense for Django. Interested to hear how common the usage would be from others on the list though. -- You received thi

Re: Feature request: get_first_or_404

2017-11-28 Thread Tim Graham
A quick search reveals a gist that contains a number of similar helpers. https://gist.github.com/stkrp/47c536b681082c638849e9a89f77ff05 I think the main problem of going down this path is deciding which are suitable to add and which aren't. I'm not sure that any of them meet the "80% of projects