Hi,
If you definitely want a get_or_none style method, django-annoying has:
# get_object_or_None function - similar to get_object_or_404, but
returns None if object not found.
http://bitbucket.org/offline/django-annoying/wiki/Home
Hope this helps,
-- Casey
On 07/22/2010 09:50 AM, Darius Da
On 2010-07-22, at 15:50 , Darius Damalakas wrote:
> This is exactly what i do not want - to manually catch exceptions.
Is there any reason for that? It is fairly common to use exceptions (and catch
them) in Python (see EAFP). Using get() and catching DoesNotExist is generally
the way such a case
Hi,
This is exactly what i do not want - to manually catch exceptions.
get_or_none function is what i need, but sad it's not here yet.
I hope when i will get to know python better, i will learn how to add
methods to all instances of some class, then i could add this method
myself. I know with jav
On Wed, Jul 21, 2010 at 12:04 PM, Darius Damalakas <
darius.damala...@gmail.com> wrote:
> Hi,
>
> I want to select a single object or get None if my query does not
> return a single object.
>
>
> So far here is what i have found in the docs (http://
> docs.djangoproject.com/en/dev/topics/db/querie
Hi,
I want to select a single object or get None if my query does not
return a single object.
So far here is what i have found in the docs (http://
docs.djangoproject.com/en/dev/topics/db/queries/#limiting-querysets):
To retrieve a single object rather than
5 matches
Mail list logo