I have a model for which the need is to show the form multiple times. I have used it under a modelformset. I seem to have a problem with the id of this model which is also the primary key for the model.
I prepopulate the formset with data which I wish to edit.
But whenever I click on submit it refreshes the page back with an error saying '(Hidden field id) with this None already exists.'
This error comes specifically for the 'id' field which is hidden
<input type="hidden" id="id_form-0-id" value="2972" name="form-0-id"/>
This is the snippet from the template. (I got it from firebug) What could the issue possibly be since the form is invalid I am not able to save the data.
ProfilesFormSet = modelformset_factory(Profile,exclude = ( <items spearated by commas>), extra=0)
profile_form_set = ProfilesFormSet(queryset = Profile.objects.filter(userprofile=userprofile).order_by('-modified_on'))
This is the code snippet.