For those of you that are having the same issue with saving related
data in a model form here is how I solved it.
The issue is that I needed to save my form and then point to the saved
record in the related record before committing the related record.
I'm surprised django doesn't handle this
Hi,
I am using 2 model forms and when I save the I get a save error since
the foreign key field can't be blank.
I try to add the new id at save, but it doesn't work.
This is the code for the save.
temp=shirtForm.save(commit=False)
userForm.shirt=temp.id
userForm.save()
2 matches
Mail list logo