I allow users to view and edit a few fields of a database record represented by a ModelForm. Here is a snippet of the code from the view:
def edit(request, id):
obj = get_object_or_404(Record, pk=record_id)
if request.method == 'POST':
form = forms.RecordForm(request.POST, instance=obj)
if form.is_valid():
form.save()
The problem is that because I don't pass all the fields to the template, form.is_valid() fails with a missing values error. How can I update an existing record with just the subset of record fields I display to the user?