Django2.1.2创建默认管理后台

1、在app的models.py中添加以下代码:

from django.db import models # Create your models here. # Register your models here. class UserType(models.Model): name = models.CharField(max_length=32) class UserInfo(models.Model): username = models.CharField(max_length=32) pwd = models.CharField(max_length=32) email = models.CharField(max_length=32) user_type = models.ForeignKey('UserType',on_delete=models.CASCADE,)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zyzyds.html