1👍
✅
Based on your latest update:
That’s super promising progress. That means database writes are happening, as returning that ID is a DB query.
You should print type(ohouse)
as well. I have a feeling you’re not saving an OHouse object.
I see you’re passing in instance=post
to each of your ModelForms
, which can’t be right. That would make Host_OHouseForm({}, instance=post)
return a new Post
object.
I’ve got my bet that’s the problem.
if post:
postform=PostForm(request.POST,instance=post, prefix="post")
tagform=TagForm(request.POST, instance=post,prefix='tags')
ohouse_form=Host_OHouseForm(request.POST,instance=post,prefix="ohouse")
1👍
I notice that you are using prefix. Check out the strange behaviour I noticed in this other answer.
Python – Django – Form choicefield and cleaned_data
edit:
are you meaning to set all your instance=post, even for your OHouse form?
Source:stackexchange.com