Django request.POST does not contain the name of the button that submitted the form

前端 未结 2 1422
生来不讨喜
生来不讨喜 2020-12-30 04:43

I have a django form with two different submit buttons, on the view where the form is submitted to I need to know what submit button was pressed and take different actions a

2条回答
  •  离开以前
    2020-12-30 04:57

    For some reason, in Chrome, when I had two buttons using tags, it would actually treat the button I didn't click as an input. That way, when I tested something like 'sendPaperButton' in request.POST, it would return the opposite of what I wanted.

    I changed these to tags and it worked fine.

提交回复
热议问题