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

cannot loaddata with choices #179

Open
johanneswilm opened this issue Mar 4, 2023 · 2 comments
Open

cannot loaddata with choices #179

johanneswilm opened this issue Mar 4, 2023 · 2 comments
Labels

Comments

@johanneswilm
Copy link

When I try to dumpdata and subsequently loaddata, I get a large amount of errors thrown. This seems to be due to choices being converted to their slug equivalent when saving to the database while the original choices values are checked for.

  File ".../python-3.11.2/lib/python3.11/site-packages/survey/models/answer.py", line 87, in check_answer_for_select
    raise ValidationError(msg)
django.core.exceptions.ValidationError: ["Impossible answer 'spiser-ikke-fisk' should be in ['Spiser ikke fisk', 'Spiser ofte fisk', 'Spiser fisk hver dag', 'Spiser overvejende fisk', 'Spiser kun fisk'] "]
@johanneswilm
Copy link
Author

A quick fix: override https://github.com/Pierre-Sassoulas/django-survey/blob/main/survey/models/question.py#L376 to not use slugify. That way the original values are storied, not the slugified ones.

@Pierre-Sassoulas
Copy link
Owner

Can you open a merge request with this fix @johanneswilm, please ? I'm not sure what tests will break but I don't remember exactly why I did that in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants