迁移后无法访问管理员中的用户 [英] Can't access users in admin after migration

查看:109
本文介绍了迁移后无法访问管理员中的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我成功地从配置文件模型迁移到扩展的用户模型。数据迁移工作正常,但我无法从管理员访问我的用户,我收到以下错误:

So I successfully migrated from a profile model to an extended User model. The data migration all worked fine, but I can't access my users from the admin, I get the following error:

DatabaseError: (1146, "Table 'mydb.app_myuser_groups' doesn't exist")

models.py 如下:

class MyUser(AbstractUser):
    isSpecial = models.BooleanField(default=True)

https://stackoverflow.com/a/15059338/319618\">这些说明。有更多的我需要做的是让这个工作吗?

having followed these instructions. Is there more I need to do to get this to work?

推荐答案

看到我以前的答案这里和修改步骤4看起来像这样:

See my previous answer here and modify step 4 to look like this:

# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Fill in the destination name with the table name of your model
        db.rename_table('auth_user', 'accounts_user')
        db.rename_table('auth_user_groups', 'accounts_user_groups')

    def backwards(self, orm):
        db.rename_table('accounts_user', 'auth_user')
        db.rename_table('accounts_user_groups', 'auth_user_groups')

    models = { ....... } # Leave this alone

这篇关于迁移后无法访问管理员中的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆