from django.db import models from django.contrib.postgres.fields import JSONField # Create your models here. class Dish(models.Model): name = models.CharField(max_length=255, unique=True) # 假设每个菜名是唯一的 image = models.TextField() # 存储图片的 Base64 编码 likes = models.IntegerField(default=0) tags = models.TextField() # 可以存储标签列表,例如以逗号分隔的字符串 indications = models.TextField() Calories = models.CharField(max_length=255, unique=False, blank=True, null=True) Salt = models.CharField(max_length=255, unique=False, blank=True, null=True) Protein = models.CharField(max_length=255, unique=False, blank=True, null=True) Total_fat = models.CharField(max_length=255, unique=False, blank=True, null=True) Total_Carbohydrate = models.CharField(max_length=255, unique=False, blank=True, null=True) Total_sugar = models.CharField(max_length=255, unique=False, blank=True, null=True) Dietary_fiber = models.CharField(max_length=255, unique=False, blank=True, null=True) Soluble_fiber = models.CharField(max_length=255, unique=False, blank=True, null=True) Insoluble_fiber = models.CharField(max_length=255, unique=False, blank=True, null=True) K = models.CharField(max_length=255, unique=False, blank=True, null=True) Ca = models.CharField(max_length=255, unique=False, blank=True, null=True) Mg = models.CharField(max_length=255, unique=False, blank=True, null=True) P = models.CharField(max_length=255, unique=False, blank=True, null=True) Fe = models.CharField(max_length=255, unique=False, blank=True, null=True) Zn = models.CharField(max_length=255, unique=False, blank=True, null=True) I = models.CharField(max_length=255, unique=False, blank=True, null=True) Cholesterol = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_B1 = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_B2 = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_C = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_B6 = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_B12 = models.CharField(max_length=255, unique=False, blank=True, null=True) Folate = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_A = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_D = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_K = models.CharField(max_length=255, unique=False, blank=True, null=True) Vitamin_E = models.CharField(max_length=255, unique=False, blank=True, null=True) Saturated_fatty_acid = models.CharField(max_length=255, unique=False, blank=True, null=True) Monounsaturated_fatty_acid = models.CharField(max_length=255, unique=False, blank=True, null=True) Polyunsaturated_fatty_acid = models.CharField(max_length=255, unique=False, blank=True, null=True) Ingredients = models.TextField() Steps = models.JSONField() Step_images_Base64 = models.JSONField()