Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
yamijuan opened this issue Aug 9, 2019 · 0 comments · May be fixed by #15
Open

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

yamijuan opened this issue Aug 9, 2019 · 0 comments · May be fixed by #15

Comments

@yamijuan
Copy link
Member

yamijuan commented Aug 9, 2019

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"),
            ],
        }
    ]
}
@ddisisto ddisisto linked a pull request Jan 20, 2020 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant