1👍
✅
You have to store the extra argument before calling super
and afterwards use the stored argument
class SelectionFournisseur(forms.Form):
def __init__(self, *args, **kwargs):
self._choixF = kwargs.pop('choixF', None)
super().__init__(*args, **kwargs)
self.fields['Fournisseur'].choices = self._choixF
Now your extra argument does not interfere with the super().__init__
call.
👤dgw
Source:stackexchange.com