You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
1.0 KiB

from django.db import models
class User(models.Model):
id = models.CharField(max_length=40,primary_key=True)
nickname = models.CharField(max_length=40)
joining_date = models.DateField(auto_now_add=True)
class Flavor(models.Model):
sour = models.DecimalField(max_digits=2, decimal_places=1)
sweet = models.DecimalField(max_digits=2, decimal_places=1)
bitter = models.DecimalField(max_digits=2, decimal_places=1)
spicy = models.DecimalField(max_digits=2, decimal_places=1)
salty = models.DecimalField(max_digits=2, decimal_places=1)
class FoodType(models.Model):
name = models.CharField(max_length=20, unique=True)
kind = models.CharField(max_length=20)
class UserFlavor(Flavor):
user = models.OneToOneField(User, on_delete=models.CASCADE, default='')
class UserPreferFoodType(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, default='')
liking = models.DecimalField(max_digits=2, decimal_places=1, default=0)
food_type = models.ForeignKey(FoodType, on_delete=models.CASCADE,default='')