简体   繁体   中英

Django-Registration: How to alter the form (need to add submit button that works!)

So I am trying to alter one of the forms from Django-registration : an app I installed via pip.

As stated in the docs, I was to created a registration/registration_form.html and use form as my context:

<html>
<p>This is the registration form</p>
<ul>
{{ form.as_ul}}
</ul>
</html>

So I have 2 questions:

1) How am I to alter the form to have a submit button that actually works in this case?

2) How can I alter the django-registration models so that I can ultimately add more to the registration forms?

Yes I looked over the docs, I am asking here because the language confused me and seemed slightly advance for me.

Thank you!

You need to add the form tags and a submit button. Something like this:

<html>
  <p>This is the registration form</p>
  <form action="/url/to/register/" method="POST">
    {{form.as_ul}}
    <input type="submit" value="Register">
  </form>
</html>

where "/url/to/register/" will need to be pointed at your view code in your urls.py. Something like this:

from django.conf.urls import url, patterns
from yoursite.registrations import views

urlpatterns = patterns('',
    url(r'^url/to/register/', views.register_some_guy),
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM