Fill user profile on user registration with Django

烂漫一生 提交于 2021-02-10 11:48:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!