[Fixed]-Add model relation to ModelForm before saving

1👍

Capture the object returned from form.save(commit=False) and modify that rather than the form. EG:

if form.is_valid():
    article = form.save(commit=False)
    article.author = author
    article.save()
    return redirect('success')

Leave a comment