Home  >  Q&A  >  body text

python - django 增加user一个field 集成AbstractUser 同步数据库总提示 fields.E301...

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_leeringa_lee2724 days ago1026

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 15:43:04

    Has your problem been solved? Want to know the solution?

    reply
    0
  • Cancelreply