Skip to content
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 new person form validation #1406

Merged
merged 3 commits into from Apr 7, 2021
Merged

Conversation

symroe
Copy link
Member

@symroe symroe commented Apr 7, 2021

No description provided.

This bug was caused by the form using the `to_python` value of the
field, in other words the model object. The string version of this was
something like `<Ballot
ballot_paper_id='local.leeds.morley-south.2021-05-06' winner_count=1>`.

This in turn was being submitted to the field, and a ValidationError was
being raised, as that string isn't a valid ballot_paper_id.

The fix is to use prepare_value. This method is undocumented, but is
used by Djanog form fields themselves.
@symroe symroe merged commit 1177824 into master Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants