Requires that the user be logged AND be set as a superuser

def admin_required(obj):
    """
    Requires that the user be logged AND be set as a superuser
    """
    decorator = request_passes_test(lambda r, *args, **kwargs: r.user.is_superuser)
    return wrap_object(obj, decorator)