How to use different form in Django-Registration

后端 未结 5 1550
小蘑菇
小蘑菇 2021-02-15 15:39

Django-Registration has several form classes in the forms.py file. One is \"class RegistrationFormTermsOfService(RegistrationForm) ..

What do I change in the rest of Dja

5条回答
  •  既然无缘
    2021-02-15 16:18

    You'll need to write a new registration form somewhere in your project. You can inherit off of the existing authentication form if you're just expanding new fields. You'll then want to write a new backend to process the form. Finally you'll need to write your own url and auth_urls and redefine the urls to switch the backend and authentication form in the views by changing the variables that get passed to the view.

    It's helpful to break open the source to see how things are working. I base my structure off of the original django-registration code to keep things consistent.

提交回复
热议问题