mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #22497 -- Highlighted difference between field and class deconstruction.
Thanks nliberg for the suggestion.
This commit is contained in:
parent
1ce759b69f
commit
b829d53b37
2 changed files with 19 additions and 13 deletions
|
@ -502,8 +502,10 @@ Adding a deconstruct() method
|
|||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can let Django serialize your own custom class instances by giving the class
|
||||
a ``deconstruct`` method. It takes no arguments, and should return a tuple
|
||||
of 3 things: ``(path, args, kwargs)``.
|
||||
a ``deconstruct()`` method. It takes no arguments, and should return a tuple
|
||||
of three things: ``(path, args, kwargs)``. Note this return value is different
|
||||
from the ``deconstruct()`` method :ref:`for custom fields
|
||||
<custom-field-deconstruct-method>` which returns a tuple of four items.
|
||||
|
||||
``path`` should be the Python path to the class, with the class name included as the
|
||||
last part (for example, ``myapp.custom_things.MyClass``). If your class is not
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue