import uuid from django.contrib.auth.models import AbstractUser, User from django.db import models # Create your models here. class YearRange(models.Model): id = models.UUIDField('id',primary_key=True,default=uuid.uuid4) user = models.ForeignKey(User,blank=False,null=False,on_delete=models.CASCADE) start_year = models.CharField('起始年份',max_length=256) end_year = models.CharField('截止年份',max_length=256) def __str__(self): return str(self.user)