Override the views class' supported formats for the decorated function.

    Arguments:
    formats -- A list of strings describing formats, e.g. ``['html', 'json']``.

def override_supported_formats(formats):
    """
    Override the views class' supported formats for the decorated function.

    Arguments:
    formats -- A list of strings describing formats, e.g. ``['html', 'json']``.
    """
    def decorator(function):
        @wraps(function)
        def wrapper(self, *args, **kwargs):
            self.supported_formats = formats
            return function(self, *args, **kwargs)
        return wrapper
    return decorator