class User(AbstractUser):
nickName=models.CharField(max_length=128)
userImage=models.ImageField(upload_to="userProfile/image",default='userProfile/image/default.jpg',max_length=300,blank=True,null=True)
cellphone=models.CharField(max_length=11)
Example of an abstract model
from django.db import models
class BaseContent(models.Model):
title=models.CharField(max_length=100)
created=models.DateTimeField(auto_now_add=True)
class Meta:
abstract=True
class Text(BaseContent):
body=models.TextField()
models.py
AUTH_USER_MODEL = 'login.User'
django 2.0适用
`
`
` from .models import User