数据库结构备份
from django.db import models # Create your models here. class User(models.Model): username=models.CharField(max_length=32) password=models.CharField(max_length=32) role = models.ForeignKey("Role", on_delete=models.CASCADE) class Role(models.Model): name=models.CharField(max_length=32) class Province(models.Model): province = models.CharField(max_length=32) class City(models.Model): city=models.CharField(max_length=32) province=models.ForeignKey("Province",on_delete=models.CASCADE) class Customer(models.Model): long_name=models.CharField(max_length=32) short_name=models.CharField(max_length=32,null=True) address=models.CharField(max_length=64) register_time=models.DateField(auto_now_add=True) city=models.ForeignKey("City",on_delete=models.CASCADE) role=models.ForeignKey("Role",on_delete=models.CASCADE) user=models.ForeignKey("User",on_delete=models.CASCADE) class Client(models.Model): name=models.CharField(max_length=32) SEX_CHOICES=(("F","女"),("M","男")) gender = models.CharField(max_length=2,choices=SEX_CHOICES,default="M") role_position=models.CharField(max_length=32) cellphone=models.CharField(max_length=32) telephone=models.CharField(max_length=32,null=True) qq=models.CharField(max_length=32,null=True) email=models.EmailField(null=True) register_time = models.DateField(auto_now_add=True) #一个外键链接 客户表 customer=models.ForeignKey("Customer",on_delete=models.CASCADE) class Visit(models.Model): content=models.TextField(max_length=32) client=models.ForeignKey("Client",on_delete=models.CASCADE) register_user=models.ForeignKey("User",on_delete=models.CASCADE) register_time = models.DateField(auto_now_add=True)