-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve HiddenUnless for composite field #6267
base: master
Are you sure you want to change the base?
Improve HiddenUnless for composite field #6267
Conversation
Could you split that into a separate commit please? That way it's easier for us to just remove that commit when we are ready to merge it. |
indico/web/forms/validators.py
Outdated
i = 0 | ||
while i < len(v): | ||
if values[i] is not None and v[i] not in values[i]: | ||
return False | ||
i += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks like a good case for something like any(... for ... in zip(v, values))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see how I can use the zip...
best can do:
if(any(v[i] for i in range(len(v)) if values[i] and v[i] not in values[i]):
return False
Done: #6268 |
Request change for HiddenUnless validator:
this change renders the validator working on field composed of list of other fields (like "visibility" in Participant List Privacy form),
it also adds an option "inverted" for the validator.
Note:
I added 2 test fields on RegistrationPrivacyForm for visual testing.