kers/events/models.py
2020-07-22 04:02:13 +02:00

22 lines
629 B
Python

from django.db import models
from users.models import CustomUser
class Event(models.Model):
date = models.DateTimeField()
capacity = models.IntegerField()
class EventRegistration(models.Model):
REGISTRATION_STATE = (
('I', 'Interested'),
('A', 'Admitted'),
('D', 'Denied'),
)
event = models.ForeignKey(Event, on_delete=models.CASCADE)
user = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
state = models.CharField(max_length=1, choices=REGISTRATION_STATE)
def __str__(self):
return f'Reservation[{self.user.username}:{self.event.date}:{self.state}]'