Django class-based CreateView and UpdateView with multiple inline formsets

前端 未结 4 1608
抹茶落季
抹茶落季 2020-12-23 10:52

I have been trying to do Django class-based CreateView and UpdateView with multiple inline formsets

CreateView works fine but UpdateView is not working properly, If

4条回答
  •  没有蜡笔的小新
    2020-12-23 11:07

    My guess is that you can't do

    self.object = None
    

    on overwritten post method in a UpdateView. So, try

    self.object = self.get_object()
    

    instead, once you already have an object instance in this case.

提交回复
热议问题