#19643: TypedChoiceField and TypedMultipleChoiceField call the super validate()
method instead of their own
-------------------------+-------------------------------------------------
Reporter: | Owner: nobody
BerislavLopac | Status: new
Type: Bug | Version: master
Component: Forms | Keywords: MultipleChoiceField
Severity: Normal | TypedMultipleChoiceField
Triage Stage: | Has patch: 0
Unreviewed | UI/UX: 0
Easy pickings: 1 |
-------------------------+-------------------------------------------------
As it can be seen on
https://github.com/django/django/blob/master/django/forms/fields.py#L730,
instead of calling self.validate() the code is actually
super(TypedChoiceField, self).validate(value); it's the same on
https://github.com/django/django/blob/master/django/forms/fields.py#L780
On the other hand, the definition of the validate() methods in both
classes is a simple "pass".
I believe this is a bug because it makes it impossible to extend those
classes and customize the validate() method. Specifically, in this example
the validate() is never called:
{{{
class CustomTypedMultipleChoiceField(forms.TypedMultipleChoiceField):
def validate(self, value):
print("CustomTypedMultipleChoiceField.validate")
}}}
I propose that, instead of the current situation, lines 730 and 780 are
replaced with self.validate(), and the validate() method definitions are
either removed or changed to call the super.
--
Ticket URL: <https://code.djangoproject.com/ticket/19643>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.