mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[2.1.x] Fixed #29423 -- Documented Field.value_from_object().
Backport of 4c35a173e8 from master
This commit is contained in:
committed by
Tim Graham
parent
6b91152a10
commit
ecb825abe2
@@ -679,8 +679,8 @@ Converting field data for serialization
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To customize how the values are serialized by a serializer, you can override
|
||||
:meth:`~Field.value_to_string`. Using ``value_from_object()`` is the best way
|
||||
to get the field's value prior to serialization. For example, since our
|
||||
:meth:`~Field.value_to_string`. Using :meth:`~Field.value_from_object` is the
|
||||
best way to get the field's value prior to serialization. For example, since
|
||||
``HandField`` uses strings for its data storage anyway, we can reuse some
|
||||
existing conversion code::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user