You need an "action" attribute to your form https://www.w3schools.com/tags/att_form_action.asp
On 23 November 2017 at 22:12, Tom Tanner <[email protected]> wrote: > My page has a registration form at `"/login_register/"`. I want the form > to send a POST request to `"/register/"`. Here's my code so far. > > `urls.py`: > url("^login_register/$", views.login_register, name="login_register"), > url("^register/$", views.register, name="register"), > > > `views.py`: > def login_register(request, template="pages/login_register.html"): > ''' > Display registration and login forms > ''' > registration_form= RegisterForm() > return render(request, template, {"registration_form": registration_form > }) > > > def register(request): > ''' > Process user registration > ''' > if request.method=="POST": > # Some code here > > > `pages/login_register.html`: > # For this example, I only include the registration form's HTML > <h2>Register</h2> > <form method="post"> > {% csrf_token %} > {{ registration_form.as_p }} > <button type="submit">Register</button> > </form> > > > When I hit "Register" on the form, my browser sends a POST request to > "login_register/". I want it to send a POST request to "register/". How do > I do this? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/72030063-8482-4723-9f2c-b25b17656a43%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/72030063-8482-4723-9f2c-b25b17656a43%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Wildman and Herring Limited, Registered Office: 28 Brock Street, Bath, United Kingdom, BA1 2LN, Company no: 05766374 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPZHCY6bUmJ9BkCTvukDbbv2YZVXXAgY9%3DdEKBaqjru0R%2BXFrQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

