django.shortcuts._get_object_or_404 - python examples

Here are the examples of the python api django.shortcuts._get_object_or_404 taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

3 View Complete Implementation : generics.py
Copyright Apache License 2.0
Author : BeanWei
def get_object_or_404(queryset, *filter_args, **filter_kwargs):
    """
    Same as Django's standard shortcut, but make sure to also raise 404
    if the filter_kwargs don't match the required types.
    """
    try:
        return _get_object_or_404(queryset, *filter_args, **filter_kwargs)
    except (TypeError, ValueError, ValidationError):
        raise Http404

0 View Complete Implementation : shortcuts.py
Copyright MIT License
Author : flavors
def get_object_or_not_found(queryset, *args, **kwargs):
    try:
        return _get_object_or_404(queryset, *args, **kwargs)
    except (TypeError, ValueError, ValidationError, Http404):
        raise exceptions.NotFound(**kwargs)