Skip to content

If first validator fails, the rest shouldn't be evaluated #13

Description

@yamijuan

Currently I have a menu where I use the is_authenticated validation of menu_generator so I don't to ask that again in my own validator, but due the fact all validators are evaluated, an anonymous user reaches my validator and fails. Here is and example:

MENUS = {
    "NAV_MENU_LEFT": [
        {
            "name": _("Users"),
            "url": "/",
            "icon_class": "fal fa-user",
            "validators": [
                "menu_generator.validators.is_authenticated",
                ("users.validators.has_user_type", "superuser"),
            ],
        }
    ]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions