我有以下型號 from django.contrib.auth.models import User
...
class Experiment(models.Model):
""" Experiment class """
date = models.DateTimeField(auto_now=True, auto_now_add=True)
user = models.Foreign
我不明白這種行爲。比方說,我打開一個Django的外殼和類型: from django.contrib.auth.models import User
user = User.objects.create(username="toto", email="titi")
爲什麼Django的讓我創建這個用戶(使用無效的電子郵件),而不產生錯誤? 我在使用tastypie創建的API中的POST中
我試圖創建新用戶(+他們的個人資料),它似乎是好的(響應201),但數據庫上的密碼爲空。 我有以下型號: class CliProfile(models.Model):
user = models.OneToOneField(User, related_name='cliuser')
# other stuff
和以下資源: class CliProfileResource