-
Notifications
You must be signed in to change notification settings - Fork 5
support for Django 5.0+ choice override types (dictionaries and calla… #178
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
base: main
Are you sure you want to change the base?
Changes from all commits
32dc9a1
914b828
983c0e0
e08e80f
552d591
050decb
e21b1b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,161 @@ | ||||
| import pytest | ||||
| from django.db import models | ||||
| from django_enum import EnumField | ||||
| from django.db.models import IntegerChoices | ||||
| from django import VERSION as django_version | ||||
|
||||
| from django import VERSION as django_version |
Copilot
AI
Mar 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test expects a ValidationError, but it currently uses pytest.raises(Exception), which can mask unrelated errors and make failures harder to diagnose. Prefer asserting the specific django.core.exceptions.ValidationError (as other tests in this suite do).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NonStrictFlagMixin.render() converts self.choices with
list(self.choices). Ifself.choicesis a dict (allowed on Django 5+), this becomes a list of keys, which will break the subsequent(choice, label)unpacking in_get_values()and also makes the laterisinstance(self.choices, dict)branch unreachable. Consider preserving the original dict (or converting dicts via.items()) before iterating/unpacking so dict-based choices work correctly.