Fixed #25764 -- Added support for serialization of enum.Enum in migrations.

Thanks Tim Graham for the review.
This commit is contained in:
Andrei Fokau 2015-11-16 22:41:46 +01:00 committed by Tim Graham
parent 65764a9316
commit 998894e1b9
6 changed files with 83 additions and 1 deletions

View file

@ -138,6 +138,7 @@ dependencies:
* bcrypt_
* docutils_
* enum34_ (Python 2 only)
* geoip2_
* jinja2_ 2.7+
* numpy_
@ -171,6 +172,7 @@ associated tests will be skipped.
.. _bcrypt: https://pypi.python.org/pypi/bcrypt
.. _docutils: https://pypi.python.org/pypi/docutils
.. _enum34: https://pypi.python.org/pypi/enum34
.. _geoip2: https://pypi.python.org/pypi/geoip2
.. _jinja2: https://pypi.python.org/pypi/jinja2
.. _numpy: https://pypi.python.org/pypi/numpy

View file

@ -174,7 +174,7 @@ Management Commands
Migrations
^^^^^^^^^^
* ...
* Added support for serialization of ``enum.Enum`` objects.
Models
^^^^^^

View file

@ -645,6 +645,7 @@ Django can serialize the following:
- ``datetime.date``, ``datetime.time``, and ``datetime.datetime`` instances
(include those that are timezone-aware)
- ``decimal.Decimal`` instances
- ``enum.Enum`` instances
- ``functools.partial`` instances which have serializable ``func``, ``args``,
and ``keywords`` values.
- Any Django field
@ -656,6 +657,10 @@ Django can serialize the following:
Serialization support for `functools.partial` was added.
.. versionchanged:: 1.10
Serialization support for ``enum.Enum`` was added.
Django can serialize the following on Python 3 only:
- Unbound methods used from within the class body (see below)