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

IntegerDjangoChoices field not working #5

Closed
sanginovs opened this issue Aug 29, 2022 · 1 comment
Closed

IntegerDjangoChoices field not working #5

sanginovs opened this issue Aug 29, 2022 · 1 comment

Comments

@sanginovs
Copy link

Hi there
I am trying out this library and been enjoying it so far.
I am running into this issue. Whenever i use IntegerChoicesField in my model and try to create a model using Django admin interface, it throws this error:

Select a valid choice. 1 is not one of the available choices.

Screen Shot 2022-08-28 at 4 07 38 PM

I am using the example code given:

class MyModel(models.Model):
  ...
  class IntegerEnum(models.IntegerChoices):
        FIRST = 1, "First Description"
        SECOND = 2, "Second Description"

    i_field = IntegerChoicesField(
        choices_enum=IntegerEnum,
        default=IntegerEnum.FIRST,
    )


TextChoicesField is working for me but IntegerChoicesField is throwing this error. appreciate any help

@sanginovs
Copy link
Author

@bellini666 thanks for a quick fix

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

No branches or pull requests

1 participant