How insert 2 different forms on the same page in Django

前端 未结 6 1836
醉话见心
醉话见心 2021-01-03 04:30

I have to insert 2 forms in the same page:

1) Registration form

2) Login form

.

So if I use this in the views.py:

    if requ         


        
6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 05:00

    You can submit two forms on the same page... but the action that each form calls (i.e. the view function that will process each form) should probably be different. That way, you won't have to try and distinguish the forms.

    e.g. On your page:

    ...form fields...
    ...form fields...

    And so, in views.py, you'll have a login() view function and a registration() view function that will handle each of those forms.

提交回复
热议问题