--
Ticket URL: <https://code.djangoproject.com/ticket/34715>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> want to contribute new method get_object_or_none
> As django developer many developers are facing this issue some time they
> want object and they also want if object doesn't exist tin that case
> default they will get None object
> because puting every time try except for this is very irritating so i
> want to propose this function
New description:
I want to contribute new method get_object_or_none
this method will be return object if object exist other wise this method
will return None
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34715#comment:1>
Old description:
> I want to contribute new method get_object_or_none
> this method will be return object if object exist other wise this method
> will return None
New description:
I would like to propose a new method called get_object_or_none, which
would return an object if it exists, and None otherwise. This
functionality is often desired by developers, as it eliminates the need to
use try-except blocks and simplifies the code where developer wants object
if exist otherwise None.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34715#comment:2>
* status: new => closed
* has_patch: 1 => 0
* resolution: => duplicate
Comment:
Duplicate of #2659.
--
Ticket URL: <https://code.djangoproject.com/ticket/34715#comment:3>