diff options
Diffstat (limited to 'docs/ref/forms')
| -rw-r--r-- | docs/ref/forms/api.txt | 8 | ||||
| -rw-r--r-- | docs/ref/forms/fields.txt | 11 |
2 files changed, 8 insertions, 11 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 1c4185156d..e64e25d241 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -810,12 +810,11 @@ Customizing the error list format By default, forms use ``django.forms.utils.ErrorList`` to format validation errors. If you'd like to use an alternate class for displaying errors, you can -pass that in at construction time (replace ``__str__`` by ``__unicode__`` on -Python 2):: +pass that in at construction time:: >>> from django.forms.utils import ErrorList >>> class DivErrorList(ErrorList): - ... def __str__(self): # __unicode__ on Python 2 + ... def __str__(self): ... return self.as_divs() ... def as_divs(self): ... if not self: return '' @@ -840,8 +839,7 @@ they're not the only way a form object can be displayed. Used to display HTML or access attributes for a single field of a :class:`Form` instance. - The ``__str__()`` (``__unicode__`` on Python 2) method of this - object displays the HTML for this field. + The ``__str__()`` method of this object displays the HTML for this field. To retrieve a single ``BoundField``, use dictionary lookup syntax on your form using the field's name as the key:: diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 8dfe26aa79..2008e65b95 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -1183,12 +1183,11 @@ method:: ... </select> - The ``__str__`` (``__unicode__`` on Python 2) method of the model will be - called to generate string representations of the objects for use in the - field's choices; to provide customized representations, subclass - ``ModelChoiceField`` and override ``label_from_instance``. This method will - receive a model object, and should return a string suitable for representing - it. For example:: + The ``__str__()`` method of the model will be called to generate string + representations of the objects for use in the field's choices. To provide + customized representations, subclass ``ModelChoiceField`` and override + ``label_from_instance``. This method will receive a model object and should + return a string suitable for representing it. For example:: from django.forms import ModelChoiceField |
