0

这是我的模型:

class Profile(models.Model):
 28     owner = models.OneToOneField(User)
 29     title = models.CharField(max_length=20,null=True)
 30     slogan = models.TextField(null=True)
 31     twitter = models.CharField(max_length = 100,null=True)
 32     web_site = models.CharField(max_length=100,null=True)
 33     email = models.EmailField(max_length = 100,null=True)
 34 
 35     def create_user(sender,instance,created,**kwargs):
 36         if created:
 37             Profile.objects.create(owner=instance)
 38 
 39     post_save.connect(create_user, sender=User)
 40 
 41     def __unicode__(self):
 42         return self.title

它抛出:

TypeError at /superadmin/auth/user/

coercing to Unicode: need string or buffer, NoneType found

我试图返回每个字段。但还是一样。。

我想念什么?

谢谢你!

4

1 回答 1

3

该文档特别警告不要null=True在 CharFields 上使用。不要这样做。

于 2012-09-23T21:29:37.093 回答