Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #33916 -- Added support for serialization of enum.Flag in migrations. #15949

Closed

Conversation

KommuSoft
Copy link
Contributor

No description provided.

Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KommuSoft Thanks 👍 I moved tests that work without any changes to a separate PR, see #15962. Please add also a release note and mention enum.Flag in "Serializing values", e.g.

diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt
index cf3451a782..9c32fa9a53 100644
--- a/docs/topics/migrations.txt
+++ b/docs/topics/migrations.txt
@@ -739,7 +739,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
+- ``enum.Enum`` and ``enum.Flag`` instances
 - ``uuid.UUID`` instances
 - :func:`functools.partial` and :class:`functools.partialmethod` instances
   which have serializable ``func``, ``args``, and ``keywords`` values.
@@ -756,6 +756,10 @@ 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:: 4.2
+
+    Serialization support for ``enum.Flag`` was added.
+
 Django cannot serialize:
 
 - Nested classes

django/db/migrations/serializer.py Outdated Show resolved Hide resolved
django/db/migrations/serializer.py Outdated Show resolved Hide resolved
django/db/migrations/serializer.py Outdated Show resolved Hide resolved
@felixxm felixxm changed the title let the EnumSerializer work for flag enums fixing #33916 Fixed #33916 -- Added support for serialization of enum.Flag in migrations. Aug 16, 2022
@KommuSoft
Copy link
Contributor Author

Updated based on the PR comments.

@felixxm
Copy link
Member

felixxm commented Aug 25, 2022

@KommuSoft Thanks 👍 Welcome aboard ⛵

I added release notes and removed redundant tests, see #15996.

@felixxm felixxm closed this Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants