toolware/utils/query.py
def get_unique_or_none(klass, *args, **kwargs):
    """ Returns a unique instance of `klass` or None """
    try:
        return klass.objects.get(*args, **kwargs)
    except klass.DoesNotExist:
        return None
    except klass.MultipleObjectsReturned:
        return None
    return None
def get_unique_or_none(klass, *args, **kwargs):
    try:
        return klass.objects.get(*args, **kwargs)
    except klass.DoesNotExist:
        return None
    except klass.MultipleObjectsReturned:
        return None
    return None
def get_unique_or_none ( klass , * args , * * kwargs ) : try : return klass . objects . get ( * args , * * kwargs ) except klass . DoesNotExist : return None except klass . MultipleObjectsReturned : return None return None
Returns a unique instance of `klass` or None
Returns a unique instance of klass or None