python - django 增加user一个field 集成AbstractUser 同步数据库总提示 fields.E301...
ringa_lee
ringa_lee 2017-04-17 15:41:04
0
1
1025

manage.py@OMS > makemigrations
CommandError: System check identified some issues:

ERRORS:
index.Message.msg_author: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out.
HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'.

models.py

-- coding: utf8 --

from django.db import models
from django.contrib.auth.models import AbstractUser
from index.models import FunChildList

class MyUser(AbstractUser):
my_permissions = models.ManyToManyField(FunChildList, null=True, blank=True)

settings.py设置:

Application definition

AUTH_USER_MODEL = "userCenter.MyUser"

ringa_lee
ringa_lee

ringa_lee

répondre à tous(1)
大家讲道理

你的问题解决了吗?想知道解决方案?

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!