def get_visible_object_or_404(klass, *args, **kwargs):
    """
    Convenience replacement for `get_object_or_404` that automatically finds
    and returns only the *visible* copy of publishable items, or raises
    `Http404` if a visible copy is not available even when a draft copy is
    available.
    """
    qs = _get_queryset(klass)
    # If class is publishable, find only *visible* objects
    try:
        qs = qs.visible()
    except AttributeError:
        pass  # Ignore error calling `visible()` on unpublishable class
    return get_object_or_404(qs, *args, **kwargs)
def get_visible_object_or_404 ( klass , * args , ** kwargs ) : qs = _get_queryset ( klass ) try : qs = qs . visible ( ) except AttributeError : pass return get_object_or_404 ( qs , * args , ** kwargs )
Convenience replacement for `get_object_or_404` that automatically finds
    and returns only the *visible* copy of publishable items, or raises
    `Http404` if a visible copy is not available even when a draft copy is
    available.