8000 fix: django 5's choice widget is not lazy by fsbraun · Pull Request #7707 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: django 5's choice widget is not lazy #7707

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

Merged
merged 12 commits into from
Nov 30, 2023
Prev Previous commit
Next Next commit
Fix: Django 5 choice widget is not lazy either
  • Loading branch information
fsbraun committed Nov 29, 2023
commit 12ee93026fb3ec020d49b82a4f4c5ea907872029
5 changes: 3 additions & 2 deletions cms/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ def choices(self):

@choices.setter
def _set_choices(self, value):
# we overwrite this function so no list(value) is called
self._choices = self.widget.choices = value
# we overwrite this function so no list(value) or normalize_choices(value) is called
# also, do not call the widget's setter
self._choices = self.widget._choices = value


class PageSelectFormField(forms.MultiValueField):
Expand Down