def get_object_or_none(qs, *args, **kwargs):
try:<EOL><INDENT>return qs.get(*args, **kwargs)<EOL><DEDENT>except models.ObjectDoesNotExist:<EOL><INDENT>return None<EOL><DEDENT>
Try to retrieve a model, and return None if
it is not found.
Useful if you do not want to bother with the try/except block.