From 66e14522a2131135ba899768a7b11dc2536899e3 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 27 Mar 2024 10:38:35 +0100 Subject: [PATCH] Fixed regression in choices setter for Django 4.2. --- django_filters/fields.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django_filters/fields.py b/django_filters/fields.py index 3a343651..d6ac79cb 100644 --- a/django_filters/fields.py +++ b/django_filters/fields.py @@ -275,13 +275,13 @@ def choices(self): def choices(self, value): if DJANGO_50: value = self.iterator(self, value) + # Simple `super()` syntax for calling a parent property setter is + # unsupported. See https://github.com/python/cpython/issues/59170 + super(ChoiceIteratorMixin, self.__class__).choices.__set__(self, value) else: super()._set_choices(value) value = self.iterator(self, self._choices) - - # Simple `super()` syntax for calling a parent property setter is - # unsupported. See https://github.com/python/cpython/issues/59170 - super(ChoiceIteratorMixin, self.__class__).choices.__set__(self, value) + self._choices = self.widget.choices = value # Unlike their Model* counterparts, forms.ChoiceField and forms.MultipleChoiceField do not set empty_label