Skip to content

Add support for django's enum types#6

Open
Mojken wants to merge 1 commit into5monkeys:mainfrom
Mojken:django-enum-types
Open

Add support for django's enum types#6
Mojken wants to merge 1 commit into5monkeys:mainfrom
Mojken:django-enum-types

Conversation

@Mojken
Copy link
Copy Markdown

@Mojken Mojken commented Nov 11, 2021

Seems like a reasonable idea, doesn't take much to support it. I don't know much about this project, is it meant to be used exclusively with django? If not, this makes django a dependency, and thus is a breaking change. A separate django module might be more interesting in that case. If it is, then this closes #3.

@Mojken Mojken changed the title add support for django's enum types Add support for django's enum types Nov 11, 2021
@antonagestam
Copy link
Copy Markdown
Contributor

@Mojken This is not meant to be used exclusively with Django, so the dependency/support needs to be made optional.

Comment thread tests/test_properties.py
B.b.val


def test_django_choices():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note that TextChoices can also be instantiated without explicit labels. This is valid:

class D(TextChoices):
    a = "a"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Django's IntegerChoices and TextChoices

2 participants