Skip to content

Support dataclass enums. #58

@bckohan

Description

@bckohan
Member

https://docs.python.org/3/howto/enum.html#enum-dataclass-support

enum properties is still a better way to do this - but not being part of stdlib more folks will use dataclass enumerations so django-enum should support it.

This will require adding another kwarg to the EnumField constructor that allows developers to specify the 'value' field on the dataclass.

Activity

added this to the Version 2.0 milestone on Jan 20, 2024
self-assigned this
on Jan 20, 2024
bckohan

bckohan commented on Sep 9, 2024

@bckohan
MemberAuthor

This might be OBE by #19

removed this from the Version 2.0 milestone on Sep 9, 2024
bckohan

bckohan commented on Sep 10, 2024

@bckohan
MemberAuthor

I explored this in this branch https://github.com/bckohan/django-enum/tree/dataclasses

Its more involved than I hoped. Certainly not impossible, but I put pause on it because #19 might satisfy this for the general case on every RDBMS but sqlite which does not yet support enumeration column types.

added this to the 2.3 milestone on Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @bckohan

      Issue actions

        Support dataclass enums. · Issue #58 · django-commons/django-enum