Loading AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -666,6 +666,7 @@ answer newbie questions, and generally made Django that much better: Rachel Willmer <http://www.willmer.com/kb/> Jakub Wilk <ubanus@users.sf.net> Ian A Wilson <http://ianawilson.com> Chris Wilson <chris+github@qwirx.com> Jakub Wiśniowski <restless.being@gmail.com> Maciej Wiśniowski <pigletto@gmail.com> wojtek Loading django/db/models/fields/__init__.py +4 −1 Original line number Diff line number Diff line Loading @@ -1850,7 +1850,10 @@ class TextField(Field): return smart_text(value) def formfield(self, **kwargs): defaults = {'widget': forms.Textarea} # Passing max_length to forms.CharField means that the value's length # will be validated twice. This is considered acceptable since we want # the value in the form field (to pass into widget for example). defaults = {'max_length': self.max_length, 'widget': forms.Textarea} defaults.update(kwargs) return super(TextField, self).formfield(**defaults) Loading django/forms/fields.py +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading docs/ref/models/fields.txt +7 −0 Original line number Diff line number Diff line Loading @@ -968,6 +968,13 @@ databases supported by Django. A large text field. The default form widget for this field is a :class:`~django.forms.Textarea`. .. versionchanged:: 1.7 If you specify a ``max_length`` attribute, it will be reflected in the :class:`~django.forms.Textarea` widget of the auto-generated form field. However it is not enforced at the model or database level. Use a :class:`CharField` for that. .. admonition:: MySQL users If you are using this field with MySQLdb 1.2.1p2 and the ``utf8_bin`` Loading docs/releases/1.7.txt +4 −0 Original line number Diff line number Diff line Loading @@ -488,6 +488,10 @@ Forms Each radio button or checkbox includes an ``id_for_label`` attribute to output the element's ID. * The ``<textarea>`` tags rendered by :class:`~django.forms.Textarea` now include a ``maxlength`` attribute if the :class:`~django.db.models.TextField` model field has a ``max_length``. * :attr:`Field.choices<django.db.models.Field.choices>` now allows you to customize the "empty choice" label by including a tuple with an empty string or ``None`` for the key and the custom label as the value. The default blank Loading Loading
AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -666,6 +666,7 @@ answer newbie questions, and generally made Django that much better: Rachel Willmer <http://www.willmer.com/kb/> Jakub Wilk <ubanus@users.sf.net> Ian A Wilson <http://ianawilson.com> Chris Wilson <chris+github@qwirx.com> Jakub Wiśniowski <restless.being@gmail.com> Maciej Wiśniowski <pigletto@gmail.com> wojtek Loading
django/db/models/fields/__init__.py +4 −1 Original line number Diff line number Diff line Loading @@ -1850,7 +1850,10 @@ class TextField(Field): return smart_text(value) def formfield(self, **kwargs): defaults = {'widget': forms.Textarea} # Passing max_length to forms.CharField means that the value's length # will be validated twice. This is considered acceptable since we want # the value in the form field (to pass into widget for example). defaults = {'max_length': self.max_length, 'widget': forms.Textarea} defaults.update(kwargs) return super(TextField, self).formfield(**defaults) Loading
django/forms/fields.py +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
docs/ref/models/fields.txt +7 −0 Original line number Diff line number Diff line Loading @@ -968,6 +968,13 @@ databases supported by Django. A large text field. The default form widget for this field is a :class:`~django.forms.Textarea`. .. versionchanged:: 1.7 If you specify a ``max_length`` attribute, it will be reflected in the :class:`~django.forms.Textarea` widget of the auto-generated form field. However it is not enforced at the model or database level. Use a :class:`CharField` for that. .. admonition:: MySQL users If you are using this field with MySQLdb 1.2.1p2 and the ``utf8_bin`` Loading
docs/releases/1.7.txt +4 −0 Original line number Diff line number Diff line Loading @@ -488,6 +488,10 @@ Forms Each radio button or checkbox includes an ``id_for_label`` attribute to output the element's ID. * The ``<textarea>`` tags rendered by :class:`~django.forms.Textarea` now include a ``maxlength`` attribute if the :class:`~django.db.models.TextField` model field has a ``max_length``. * :attr:`Field.choices<django.db.models.Field.choices>` now allows you to customize the "empty choice" label by including a tuple with an empty string or ``None`` for the key and the custom label as the value. The default blank Loading