mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: planning events
This commit is contained in:
38
Back-End/Planning/models.py
Normal file
38
Back-End/Planning/models.py
Normal file
@ -0,0 +1,38 @@
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.conf import settings
|
||||
|
||||
from School.models import Establishment
|
||||
|
||||
class RecursionType(models.IntegerChoices):
|
||||
RECURSION_NONE = 0, _('Aucune')
|
||||
RECURSION_DAILY = 1, _('Quotidienne')
|
||||
RECURSION_WEEKLY = 2, _('Hebdomadaire')
|
||||
RECURSION_MONTHLY = 3, _('Mensuel')
|
||||
RECURSION_CUSTOM = 4, _('Personnalisé')
|
||||
|
||||
class Planning(models.Model):
|
||||
establishment = models.ForeignKey(Establishment, on_delete=models.PROTECT)
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField(default="", blank=True, null=True)
|
||||
color= models.CharField(max_length=255, default="#000000")
|
||||
|
||||
def __str__(self):
|
||||
return f'Planning for {self.user.username}'
|
||||
|
||||
|
||||
class Events(models.Model):
|
||||
planning = models.ForeignKey(Planning, on_delete=models.PROTECT)
|
||||
title = models.CharField(max_length=255)
|
||||
description = models.TextField()
|
||||
start = models.DateTimeField()
|
||||
end = models.DateTimeField()
|
||||
recursionType = models.IntegerField(choices=RecursionType, default=0)
|
||||
color= models.CharField(max_length=255)
|
||||
location = models.CharField(max_length=255, default="", blank=True, null=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return f'Event for {self.user.username}'
|
||||
Reference in New Issue
Block a user