-
Notifications
You must be signed in to change notification settings - Fork 148
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
Fix wrong id_for_label usage in rendered evaluation edit form #1784
Fix wrong id_for_label usage in rendered evaluation edit form #1784
Conversation
Do you want to add a test? (: |
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.
This seems all correct, blocking until test though (as discussed in person)
Take this: const formData = await page.evaluate(() => {
return Object.fromEntries(new FormData(document.getElementById("evaluation-form") as HTMLFormElement));
}); |
Nice, thanks. Added that, seems to work now. I've removed the Codacy complains about magic numbers (in a test, I think they are fine: We do want to click the first button that says "xyz") and |
Co-authored-by: Niklas Mohrin <dev@niklasmohrin.de>
Fixes #1769.
Our old code was broken and just happened to work accidentally before django 4: The default widget for a choice field is a
Select
widget. With that, the rendering:wouldn't require any
id_for_label
to be set for the individual values. However, before django 4, this happened to be set, and our code relied on that with no documented guarantee.This PR changes the button groups to use
RadioSelect
widgets, which would be rendered as:i.e. here, every choice gets a seperate ID. This is also guaranteed by the docs:
So this time, if anything changes, we should see an entry in the release notes.
Edit: We can probably make a front end test for this one, it should be detectable just from the rendered html