问题
I'm developing an application with the user default authentication provided by Django (and django-registration-redux
). Also in docs, they recommend to link the user profile with a OneToOneField
in a different model,as explain here: https://docs.djangoproject.com/en/1.10/topics/auth/customizing/
The problem is: How to build a registration view that includes the profile form?
Note that it's only creating a user account with the basic data without profile info. I already have worked in other project inheriting from AbstractUser
and customizing User Model but I would like this time use Profile model
Can you help me?
回答1:
The problem is: How to build a registration view that includes the profile form?
The short answer is don't do this.
You've probably signed up on hundreds of sites yourself. Did they ask you for this information at registraion? nopes. Because it's not user fiendly. The profile creation should be separated from registration.
If you really want to gather this information you need to replace the default user registration form with your own. AFAIK there isn't a setting in django-registration-redux to change the default form. So you will have to customize the view as well. So a lot of hard work for a little gain.
Note that it's only creating a user account with the basic data without profile info
Which is exactly how it should be.
来源:https://stackoverflow.com/questions/42311146/fill-user-profile-on-user-registration-with-django