Django, register user with first name and last name?

前端 未结 2 796
无人及你
无人及你 2021-02-07 10:27

I\'m using Django-Registration and the form just has 3 fields (Username, Email, Password, and Re-password), but why I can\'t add last name and first name??

In the Form a

2条回答
  •  迷失自我
    2021-02-07 10:55

    I know you found a way around, but this way below may also interest you. This is because it requires keywords arguments (which will be passed to the User's __init__ method). https://docs.djangoproject.com/en/1.6/ref/contrib/auth/#manager-methods

    User.objects.create_user("user1", "user1@foo.bar", "pwd", first_name="First", last_name="Last")
    

提交回复
热议问题