我想創建一個自定義配置文件,以將其他字段添加到django-registration
。這裏是我的代碼至今 -django註冊create_user()意外的關鍵字
在models.py
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.ForeignKey(User, unique=True)
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
email = models.CharField(max_length=50)
password = models.CharField(max_length=50)
和settings.py
AUTH_PROFILE_MODULE = 'myproject.Profile'
不過,我收到以下錯誤,當我嘗試使用create_user( )。這是當我鍵入它解釋發生了什麼 -
>>> from django.contrib.auth.models import User
>>> User.objects.create_user(first_name='tom',last_name='smith',email='[email protected]',password='hello')
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: create_user() got an unexpected keyword argument 'first_name'
我是什麼,以便create_user()
認識到這些新的列缺?謝謝。
那麼如何存儲姓和名,如果我們不能使用create_user? – George 2013-10-17 16:16:42