feat: Ajout du logo de l'école

This commit is contained in:
N3WT DE COMPET
2025-05-31 13:22:40 +02:00
parent 8a71fa1830
commit 6a0b90e98f
8 changed files with 91 additions and 19 deletions

View File

@ -2,6 +2,12 @@ from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.utils.translation import gettext_lazy as _
import os
def registration_logo_upload_to(instance, filename):
ext = os.path.splitext(filename)[1]
return f"logos/school_{instance.pk}/logo{ext}"
class StructureType(models.IntegerChoices):
MATERNELLE = 1, _('Maternelle')
PRIMAIRE = 2, _('Primaire')
@ -22,6 +28,11 @@ class Establishment(models.Model):
is_active = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
api_docuseal = models.CharField(max_length=255, blank=True, null=True)
logo = models.FileField(
upload_to=registration_logo_upload_to,
null=True,
blank=True
)
def __str__(self):
return self.name