summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/howto/custom-model-fields.txt9
-rw-r--r--docs/internals/deprecation.txt3
-rw-r--r--docs/releases/1.9.txt3
3 files changed, 11 insertions, 4 deletions
diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-fields.txt
index 95c1cd68ab..c0cde0e99b 100644
--- a/docs/howto/custom-model-fields.txt
+++ b/docs/howto/custom-model-fields.txt
@@ -705,15 +705,16 @@ Converting field data for serialization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To customize how the values are serialized by a serializer, you can override
-:meth:`~Field.value_to_string`. Calling ``Field._get_val_from_obj(obj)`` is the
-best way to get the value serialized. For example, since our ``HandField`` uses
-strings for its data storage anyway, we can reuse some existing conversion code::
+: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
+``HandField`` uses strings for its data storage anyway, we can reuse some
+existing conversion code::
class HandField(models.Field):
# ...
def value_to_string(self, obj):
- value = self._get_val_from_obj(obj)
+ value = self.value_from_object(obj)
return self.get_prep_value(value)
Some general advice
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index 63171d09b5..f597963d8c 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -79,6 +79,9 @@ details on these changes.
* Support for setting a URL instance namespace without an application
namespace will be removed.
+* ``Field._get_val_from_obj()`` will be removed in favor of
+ ``Field.value_from_object()``.
+
.. _deprecation-removed-in-1.10:
1.10
diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt
index 27893fb97c..a9217b6145 100644
--- a/docs/releases/1.9.txt
+++ b/docs/releases/1.9.txt
@@ -1001,6 +1001,9 @@ Miscellaneous
* :class:`~django.core.signing.Signer` now issues a warning if an invalid
separator is used. This will become an exception in Django 1.10.
+* ``django.db.models.Field._get_val_from_obj()`` is deprecated in favor of
+ ``Field.value_from_object()``.
+
.. removed-features-1.9:
Features removed in 1.9