[Answer]-How to display two forms on the same page?

1👍

What if you change the names of your form variable in the return statement i.e.

{'formRegister':form}

and the other one:

{'formLogin':form}

UPDATE:

In your url file, you could do the following:

url(r'^access/login/$','users.views.login_user'),
url(r'^access/register/$','users.views.register_user'),

The same template will still be used, but with different views to handle the forms.

Other alternatives include:

  1. Putting different URLs in the action attribute of the two forms. Then you will have two different view functions to deal with the two different forms.

  2. Reading the values of submit buttons from the POST data. You can tell which submit button was clicked, then handle the logic.

Leave a comment