mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #22206 -- Passed models.TextField.max_length to forms.CharField.maxlength
This commit is contained in:
committed by
Claude Paroz
parent
ac699cdc17
commit
95c74b9d69
@@ -223,7 +223,7 @@ class CharField(Field):
|
||||
|
||||
def widget_attrs(self, widget):
|
||||
attrs = super(CharField, self).widget_attrs(widget)
|
||||
if self.max_length is not None and isinstance(widget, TextInput):
|
||||
if self.max_length is not None:
|
||||
# The HTML attribute is maxlength, not max_length.
|
||||
attrs.update({'maxlength': str(self.max_length)})
|
||||
return attrs
|
||||
|
||||
Reference in New Issue
Block a user