Skip to content
Discussion options

You must be logged in to vote

Just a stab in the dark without trying to reproduce:

Try using a StrEnum if you are on python 3.11+. Or otherwise add a __str__ function that returns self.value. I bet that would fix it.

Please try and let me know.

I suspect you are encountering this because the default json serializer that dumpdata uses serializes Enum objects by calling str() or repr(). So the above suggestion should work for you. Alternatively I think the most appropriate place to fix this would be to provide a custom serializer that understands your objects. The suggestion above is certainly cleaner, but you might have to implement a serializer if you don't control the enum implementation.

I don't think there's a way …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by kharybdys
Comment options

You must be logged in to vote
4 replies
@kharybdys
Comment options

@bckohan
Comment options

@kharybdys
Comment options

@bckohan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #147 on November 11, 2025 17:23.