Pybbm超级用户配置文件“UserProfile匹配查询不存在。”

时间:2013-03-26 07:36:58

标签: django user-profile

我在django 1.4.5上有一个项目,其中包含自定义userprofile和全新安装的pybbm,如本说明中所述https://pybbm.readthedocs.org/en/latest/install.html#enable-your-site-profile

在本说明书中: “如果启用了南方并在南方控制下使用配置文件类(如'pybb.Profile'),则在syncdb / migrate之后将不会创建超级用户的配置文件。它将在pybb.middleware首次登录此用户时创建。 PybbMiddleware“。

但是在第一次超级用户登录时,我得到: “UserProfile匹配查询不存在。”

这是完整的追溯http://dpaste.com/1035237/

我看着 process_request中的/usr/local/lib/python2.7/dist-packages/pybb/middleware.py

这里:

        if request.user.is_authenticated():
        try:
            # Here we try to load profile, but can get error
            # if user created during syncdb but profile model
            # under south control. (Like pybb.Profile).
            profile = request.user.get_profile()
        except ObjectDoesNotExist:
            # Ok, we should create new profile for this user
            # and grant permissions for add posts
            user_saved(request.user, created=True)
            profile = request.user.get_profile()

但没有创建超级用户的个人资料。

如何解决问题?

1 个答案:

答案 0 :(得分:0)

检查settings.py中是否启用了'pybb.middleware.PybbMiddleware'