我在我的 django 项目中使用 Django-rest-auth ( https://github.com/Tivix/django-rest-auth ) 进行登录和注册。我看到一个默认的注册表如下:
目前,我可以使用电子邮件而不是用户名注册新用户。MySql 数据库中的默认 auth_user 表具有以下列:(id、password、last_login、is_superuser、username、first_name、last_name、email、is_staff、is_active、date_joined)
我的 settings.py :
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'rest_framework',
#Rest-auth
'rest_framework.authtoken',
'rest_auth',
#Rest-auth registration
'allauth',
'allauth.account',
'rest_auth.registration',
#Following is added to allow cross domain requests i.e. for serving requests those are coming from frontend app
'corsheaders',
'flights',
)
我想修改我的注册表单,使其具有上面字段的名字和姓氏,这样当我注册新用户时,这两列也填充了名字和姓氏。目前我没有额外的注册视图,也没有任何自定义用户模型,我只是使用 django-rest-auth 提供的 API 端点。
我怎样才能做到这一点?
