You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from django.db import models
|
|
|
|
class Mensa(models.Model):
|
|
mensa_id = models.IntegerField()
|
|
|
|
def __str__(self):
|
|
return str(self.mensa_id)
|
|
|
|
|
|
class DailyMenu(models.Model):
|
|
date = models.DateField()
|
|
mensa = models.ForeignKey(Mensa, on_delete=models.CASCADE, default=0)
|
|
|
|
def __str__(self):
|
|
return f"Mensa {self.mensa} - {self.date}"
|
|
|
|
|
|
class Meal(models.Model):
|
|
related_daily_menus = models.ManyToManyField(DailyMenu)
|
|
name = models.CharField(max_length=100)
|
|
art = models.CharField(max_length=100, default=None)
|
|
price_student = models.FloatField(max_length=100)
|
|
price_employee = models.FloatField(max_length=100)
|
|
price_guest = models.FloatField(max_length=100)
|
|
allergens = models.CharField(max_length=100)
|
|
types = models.CharField(max_length=100)
|
|
likes = models.IntegerField(default=0)
|
|
dislikes = models.IntegerField(default=0)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
|
|
class Comment(models.Model):
|
|
meal = models.ForeignKey(Meal, on_delete=models.CASCADE, default=None)
|
|
username = models.CharField(max_length=100, default='anon')
|
|
comment = models.CharField(max_length=700)
|