mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #26516 -- Added minlength attribute when forms.CharField.min_length is set.
This commit is contained in:
@@ -235,7 +235,10 @@ class CharField(Field):
|
||||
attrs = super(CharField, self).widget_attrs(widget)
|
||||
if self.max_length is not None:
|
||||
# The HTML attribute is maxlength, not max_length.
|
||||
attrs.update({'maxlength': str(self.max_length)})
|
||||
attrs['maxlength'] = str(self.max_length)
|
||||
if self.min_length is not None:
|
||||
# The HTML attribute is minlength, not min_length.
|
||||
attrs['minlength'] = str(self.min_length)
|
||||
return attrs
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user