1👍
✅
From the official documentation
class MCQuestionAnswerForm(forms.Form):
question = forms.CharField()
mcq_answer_choice = forms.ChoiceField(widget=forms.RadioSelect)
def __init__(self, *args, **kwargs):
self.extra = kwargs.pop('extra')
super(MyArticleForm, self).__init__(*args, **kwargs)
# You have now use the value of self.extra to construct or alter your form body
# For example:
self.fields['mcq_answer_choice'].initial = self.extra
MCQuestionAnswerFormSet = formset_factory(MCQuestionAnswerForm, extra=0)
Source:stackexchange.com