Newer
Older
from django.db import models
from django.utils import timezone
from django.core.exceptions import ValidationError
class Event(models.Model):
name = models.CharField(max_length=255)
date = models.DateTimeField(null=False)
visitors = models.ManyToManyField(Profile, related_name='visitor')
created_by = models.ForeignKey(Profile, related_name='created_event', on_delete=models.DO_NOTHING)
Bodor Máté
committed
created_at = models.DateTimeField(auto_now_add=True, editable=False)
updated_at = models.DateTimeField(auto_now=True, editable=False)
def __str__(self):
return self.name
event = models.ForeignKey(Event, related_name='notes', on_delete=models.CASCADE, blank=True, null=True,)
profile = models.ForeignKey(Profile, related_name='notes', on_delete=models.CASCADE, blank=True, null=True,)
created_by = models.ForeignKey(Profile, related_name='created_notes', on_delete=models.DO_NOTHING)
created_at = models.DateTimeField(auto_now_add=True, editable=False)
updated_at = models.DateTimeField(auto_now=True, editable=False)
def __str__(self):
return self.note