rom django.db import models #导入内置的model User才能使用外键连接 from django.contrib.auth.models import User # 导入内置的model User才能使用外键连接 from django.contrib.auth.models import User from django.db import models # Create your models here. class LiuganWeekData(models.Model): date = models.DateField() infection_number = models.IntegerField() class Meta: app_label = 'app_test' # 确保这与你的应用名称匹配 class BeijingWeekData(models.Model): date = models.DateField() infection_number = models.IntegerField() class HXData(models.Model): date = models.DateField() hx_data = models.FloatField() class GFData(models.Model): date = models.DateField() gf_data = models.FloatField() class JijinData(models.Model): date = models.DateField() jijin_data = models.FloatField() class BaiduData(models.Model): date = models.DateField() liugan_index = models.IntegerField() class StockData(models.Model): date = models.DateField() shoupan = models.FloatField() # 使用外键,储存用户的基金数据 class Fund(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='funds') fund_id = models.CharField(max_length=6) # 指定 max_length fund_name = models.CharField(max_length=20) # 指定 max_length def __str__(self): return self.fund_name class CaptchaModel(models.Model): email = models.EmailField(unique=True) captcha = models.CharField(max_length=4) create_time = models.DateTimeField(auto_now_add=True) # class Meta: # app_label = 'app_test' #推荐的流感基金 class RecommendedFund(models.Model): fund_code = models.CharField(max_length=6) fund_name = models.CharField(max_length=20) data_js = models.JSONField(default=None) date_js = models.JSONField(default=None)