diff options
| author | Nick Pope <nick.pope@flightdataservices.com> | 2020-05-01 15:05:20 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-06-24 11:45:34 +0200 |
| commit | 074844e9479a9ee1420685b36189aa2881289993 (patch) | |
| tree | f281c25ce69d6b4cf79668183111fd8250537ea5 /docs | |
| parent | 162765d6c3182e36095d29543e21b44b908625fc (diff) | |
Fixed #31529 -- Added support for serialization of pathlib.Path/PurePath and os.PathLike in migrations.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/3.2.txt | 3 | ||||
| -rw-r--r-- | docs/topics/migrations.txt | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 3cc39ff285..8544df77c3 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -200,6 +200,9 @@ Migrations filename fragment that will be used to name a migration containing only that operation. +* Migrations now support serialization of pure and concrete path objects from + :mod:`pathlib`, and :class:`os.PathLike` instances. + Models ~~~~~~ diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt index 2d609f01da..b0d75a4f09 100644 --- a/docs/topics/migrations.txt +++ b/docs/topics/migrations.txt @@ -720,6 +720,11 @@ Django can serialize the following: - ``uuid.UUID`` instances - :func:`functools.partial` and :class:`functools.partialmethod` instances which have serializable ``func``, ``args``, and ``keywords`` values. +- Pure and concrete path objects from :mod:`pathlib`. Concrete paths are + converted to their pure path equivalent, e.g. :class:`pathlib.PosixPath` to + :class:`pathlib.PurePosixPath`. +- :class:`os.PathLike` instances, e.g. :class:`os.DirEntry`, which are + converted to ``str`` or ``bytes`` using :func:`os.fspath`. - ``LazyObject`` instances which wrap a serializable value. - Enumeration types (e.g. ``TextChoices`` or ``IntegerChoices``) instances. - Any Django field @@ -728,6 +733,11 @@ Django can serialize the following: - Any class reference (must be in module's top-level scope) - Anything with a custom ``deconstruct()`` method (:ref:`see below <custom-deconstruct-method>`) +.. versionchanged:: 3.2 + + Serialization support for pure and concrete path objects from + :mod:`pathlib`, and :class:`os.PathLike` instances was added. + Django cannot serialize: - Nested classes |
