mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Refs #27795 -- Replaced many force_text() with str()
Thanks Tim Graham for the review.
This commit is contained in:
@@ -706,10 +706,10 @@ smoothly:
|
||||
|
||||
2. Put a ``__str__()`` method on the class you're wrapping up as a field. There
|
||||
are a lot of places where the default behavior of the field code is to call
|
||||
:func:`~django.utils.encoding.force_text` on the value. (In our
|
||||
examples in this document, ``value`` would be a ``Hand`` instance, not a
|
||||
``HandField``). So if your ``__str__()`` method automatically converts to
|
||||
the string form of your Python object, you can save yourself a lot of work.
|
||||
``str()`` on the value. (In our examples in this document, ``value`` would
|
||||
be a ``Hand`` instance, not a ``HandField``). So if your ``__str__()``
|
||||
method automatically converts to the string form of your Python object, you
|
||||
can save yourself a lot of work.
|
||||
|
||||
Writing a ``FileField`` subclass
|
||||
================================
|
||||
|
||||
Reference in New Issue
Block a user