That's actually not a bad idea at all, much better than get_or_none().

Cal


On Tue, Mar 25, 2014 at 7:20 AM, Cheng Chi <coupohol...@chicheng.me> wrote:

> What about name it fetch()?
>
>
> On Friday, March 14, 2014 3:45:31 AM UTC+11, Cal Leeming [Simplicity Media
> Ltd] wrote:
>>
>> Seems this issue was brought up several years ago, though the thread was
>> later hijacked for other functionality and get_or_none fizzled out.
>> https://groups.google.com/forum/#!topic/django-developers/Saa5nbzqQ2Q
>>
>> In Django 1.6 there were convenience methods added for .first(), for the
>> same principle of not having to catch an IndexError (or in this case, a
>> DoesNotExist error);
>> https://docs.djangoproject.com/en/dev/ref/models/
>> querysets/#django.db.models.query.QuerySet.first
>>
>> This seems to be wanted by several users, as seen here;
>> http://stackoverflow.com/questions/1512059/django-get-
>> an-object-form-the-db-or-none-if-nothing-matches
>>
>> Seems to be quite an easy fix, just needs a proper patch.
>>
>> Any thoughts?
>>
>> Cal
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" 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 http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/815dc10d-0e4d-4db9-b42a-e2adf9760786%40googlegroups.com<https://groups.google.com/d/msgid/django-developers/815dc10d-0e4d-4db9-b42a-e2adf9760786%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAHKQagFSP9CCjT8yzexiHi3dKDuJL1jYCcYwk-eGPM2hCz2Q%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to