How to process two forms in one view?

后端 未结 3 1750
心在旅途
心在旅途 2021-01-01 02:38

I have two completely different forms in one template. How to process them in one view? How can I distinguish which of the forms was submitted? How can I use prefix to acomp

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-01 03:27

    like ayaz said, you should give unique name to form submit button

    ......
    ......
    #view if "form1" in request.POST: ... if "form2" in request.POST: ...

提交回复
热议问题