Django class based views - UpdateView with two model forms - one submit

狂风中的少年 提交于 2019-11-28 20:55:57

You should be able to use the "instance" kwarg for the instantiation of the form from an existing model if that's what you need. Example:

context['form'] = self.form_class(self.request.GET, instance=request.user)
Rafael GB

Try to quit the self.request.get on get_content_data forms constructors and use the "object" variable. With that get you reinitialize the constructor, more in this link.

My code:

 context['form'] = self.form_class(instance=self.object)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!