【发布时间】:2011-07-13 02:15:44
【问题描述】:
我有一个名为 aaa 的应用程序,并且在 aaa 的 models.py 中我有类似的东西:
from django.db import models
from django.contrib.auth.models import User
class BBB(models.Model):
user = models.OneToOneField(User)
newsletter=models.BooleanField(default=False)
我添加到我的 setting.py
AUTH_PROFILE_MODULE = 'aaa.BBB'
然后我去 django shell 并输入
>>> from django.contrib.auth.models import User
>>> a=User.objects.get(id=1)
>>> a.get_profile()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/contrib/auth/models.py", line 373, in get_profile
self._profile_cache = model._default_manager.using(self._state.db).get(user__id__exact=self.id)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/db/models/query.py", line 347, in get
% self.model._meta.object_name)
DoesNotExist: BBB matching query does not exist.
有些人知道出了什么问题? 编辑:我做 manage.py syncdb
【问题讨论】:
标签: django django-authentication