Corrected custom model fields how-to.

get_prep_value() method is complementary of from_db_value().

Follow up to e9103402c0.
This commit is contained in:
Ramiro Morales 2020-07-01 11:46:21 -03:00 committed by Mariusz Felisiak
parent 7d6916e827
commit 52a0a03671
1 changed files with 2 additions and 2 deletions

View File

@ -541,8 +541,8 @@ Converting Python objects to query values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Since using a database requires conversion in both ways, if you override
:meth:`~Field.to_python` you also have to override :meth:`~Field.get_prep_value`
to convert Python objects back to query values.
:meth:`~Field.from_db_value` you also have to override
:meth:`~Field.get_prep_value` to convert Python objects back to query values.
For example::