Modify choices of form.ChoiceField in the view

I would like to use the same Form to multiple purposes and just change the options.

Here is my form :

class ChoiceEx(forms.Form):
    choices = (("choice1", "c1"), ("choice2", "c2"))
    field = forms.ChoiceField(choices=choices,
                              widget=forms.RadioSelect(attrs={'class': "questionnaire-radio"}))

Here is my view were I want to override choice1 and choice2 by choice3 and choice4

def exChoice(request):
    choices = (("choice3", "c3"), ("choices4", "c4"))
    form = ChoiceEx()

    field = django.forms.ChoiceField(choices=choices,
                                     widget=django.forms.RadioSelect(attrs={'class': "questionnaire-radio"}))

    form.fields["field"] = field
    return render(request, 'predictions/exView.html', {"form": form})

I think I’m able to change the value of the form because the print displays :
[(‘choice3’, ‘c3’), (‘choices4’, ‘c4’)]

However, when I display my page it shows the previous form choices : choice1 and choice2
Why my form is changed to the previous value ? Is the form regenerated at one point ?

Thank you

Technically, the form gets “regenerated” every time it gets created. But I’m not sure we’re both using that word the same way here.

See the docs for choices - passing a tuple of 2-tuples isn’t your only option. You can pass a callable to that option which means you can dynamically identify what the options should be.