Changes between Initial Version and Version 1 of Ticket #32347, comment 4


Ignore:
Timestamp:
Jan 14, 2021, 1:20:01 PM (4 years ago)
Author:
Aaron Wiegel

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32347, comment 4

    initial v1  
    44> [https://github.com/django/django/blob/75182a800a621b7a5b2c0a1f39a56e753b9a58ca/django/forms/fields.py#L802-L810 Given that ChoiceField passes the value when raising the error], if you set [https://docs.djangoproject.com/en/3.1/ref/forms/fields/#error-messages error_messages] you should be able to get the result you want.
    55
    6 That is `ChoiceField`. `ModelChoiceField` (does not pass the value)[https://github.com/django/django/blob/a948d9df394aafded78d72b1daa785a0abfeab48/django/forms/models.py#L1287] to the validation error. So, when the invalid value error is raised, you can't display the offending value even if you override the defaults.
     6That is `ChoiceField`. `ModelChoiceField` [https://github.com/django/django/blob/a948d9df394aafded78d72b1daa785a0abfeab48/django/forms/models.py#L1287 does not pass the value] to the validation error. So, when the invalid value error is raised, you can't display the offending value even if you override the defaults.
Back to Top