1
0
clubhaus-schornbach/clubhaus/homepage/models.py

42 lines
1.3 KiB
Python

from django.db import models
# Create your models here.
from django.utils import timezone
class TobaccoCategory(models.Model):
name = models.CharField(max_length=200, unique=True, blank=False, null=False)
def __str__(self):
return f"{self.name} ({self.id})"
class Tobacco(models.Model):
name = models.CharField(max_length=200, unique=True, blank=False, null=False)
description = models.TextField(blank=True, null=False)
category = models.ForeignKey("TobaccoCategory", on_delete=models.CASCADE, blank=False, null=False)
in_stock = models.BooleanField()
picture = models.ImageField(upload_to="tobacco_images/", null=False, blank=True)
def __str__(self):
return self.name
class EventDate(models.Model):
event = models.ForeignKey(to="ClubhausEvent", on_delete=models.CASCADE)
date = models.DateTimeField(unique=True, default=timezone.now)
def __str__(self):
return f"{self.event.name}"
class ClubhausEvent(models.Model):
name = models.CharField(max_length=200, blank=True)
date = models.DateTimeField(blank=True, null=True)
location = models.TextField(blank=True)
beverages = models.TextField(blank=True)
food = models.TextField(blank=True)
def __str__(self):
return f"{self.name}"