2👍
✅
If your form is overwriting all the information in the instance, you could simply set the primary key manually:
if form.is_valid():
obj = form.save(commit=False)
obj.pk = form.cleaned_data['pk_to_edit']
obj.save()
return ...
Source:stackexchange.com