Skip to content

Commit

Permalink
adsuser: make sure status is correct for new ads
Browse files Browse the repository at this point in the history
  • Loading branch information
brmzkw committed Mar 21, 2024
1 parent 37281d5 commit 2e2f328
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mesads/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,10 @@ def save(self, *args, **kwargs):
raise ValidationError(
"Un seul exploitant peut être déclaré pour une ADS créée après le 1er octobre 2014."
)
if self.status != "titulaire_exploitant":
raise ValidationError(
"Le conducteur doit nécessairement être le titulaire de l'ADS (personne physique) pour une ADS créée après le 1er octobre 2014."
)
return super().save(*args, **kwargs)

ads = models.ForeignKey(ADS, on_delete=models.CASCADE)
Expand Down

0 comments on commit 2e2f328

Please sign in to comment.