-
Notifications
You must be signed in to change notification settings - Fork 32
"ValueError: too many values to unpack" with TextChoices #27
Comments
@ievans3024 I was unable to reproduce this issue using the sample you provided. I merged additional test coverage based on these values in #29, but the test suite is passing. Can you re-confirm this issue using the |
I try this, and it help me: convert keys and values to str in ModelSchemaField function Line 88 in 63836c7
enum_choices = {str(v): str(k) for k, v in field.choices} |
Hi @kaletvintsev, could you confirm if the issue is still occurring in the latest 0.3.1 release? |
Closing this, please reopen if the issues are not resolved in the latest release. |
Hi, @jordaneremieff, I think that it can still occur, since it occurs when using gettext_lazy from django.utils.translation |
@kaletvintsev can you post a minimal example of how I can recreate this issue? |
Given:
Running this using
raised the error I reported:
This is likely the missing component to my original report. I had experienced the issue in a project using lazy translation in the choices and did not think to test other scenarios. Interestingly, |
Released a fix in 0.3.5. Let me know if this does not resolve the issue @ievans3024. |
Attempting to create a djantic schema for a model that has a
django.db.models.TextChoices
subclass assigned to a field'schoices
will result in aValueError
For example:
the above results in:
The text was updated successfully, but these errors were encountered: