Creating UpdateForm by using ModelForm in Django
问题 I have a Django application and I wanna create an update form with ModelForm but I have to get the fields parameter from user_profile model. So I have created my form and view such as below. forms.py; class UpdateForm(forms.ModelForm): class Meta: model = Data fields = [] def __init__(self, *args, **kwargs): input_choices = kwargs.pop('input_choices') super(UpdateForm, self).__init__(*args,**kwargs) self.fields = input_choices views.py; @login_required(login_url = "user:login") def updateData