当我同步我的数据库时,我收到模块'对象的错误没有属性'OneToOnefield'
models.py 的代码如下:
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
class Drinker(models.Model):
user =models.OneToOnefield(User)
birthday =models.Datefield()
name =models.Charfield(max_length=100)
#create our user object to attach to our drinker object
def create_drinker_user_callback(sender, instance, **kwargs):
drinker.new=Drinker.objects.get_or_create(user=instance)
post_save.connect(create_drinker_user_callback, User)