diff --git a/src/dgsi/models.py b/src/dgsi/models.py index da77aad..32e706d 100644 --- a/src/dgsi/models.py +++ b/src/dgsi/models.py @@ -69,6 +69,14 @@ class Bylaws(LegalDocument): verbose_name_plural = _("Règlements Intérieurs") +# class TermsAndConditions(LegalDocument): +# """ +# Terms and Conditions of use regarding a service offered by the association. +# """ +# +# service = models.ForeignKey(Service, on_delete=models.CASCADE) + + class Translation(models.Model): cas_login = models.CharField(max_length=255, unique=True) username = models.CharField(max_length=255, unique=True) @@ -76,6 +84,12 @@ class Translation(models.Model): def __str__(self) -> str: return f"{self.cas_login} → {self.username}" + def save(self, **kwargs) -> None: # pyright: ignore + # INFO: Only update the model if it does not already exist + # This will prevent a lot of pain + if self.pk is None: + return super().save(**kwargs) + class Meta: # pyright: ignore verbose_name = _("Correspondance de login") verbose_name_plural = _("Correspondances de login")