fix(translations): Disable updates to an existing translation
This commit is contained in:
parent
3b3f2dd34d
commit
941f2b031e
1 changed files with 14 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Reference in a new issue