How to process two forms in one view?

后端 未结 3 1754
心在旅途
心在旅途 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:42

    If the two forms are completely different, it will certainly not hurt to have them be handled by two different views. Otherwise, you may use the 'hidden input element' trick zacherates has touched upon. Or, you could always give each submit element a unique name, and differentiate in the view which form was submitted based on that.

提交回复
热议问题