1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 09:58:23 +02:00

Display a form error rather than a page error if a guest is already invited

This commit is contained in:
Yohann D'ANELLO
2020-08-15 23:03:49 +02:00
parent 1186b0f9a9
commit b16871d925
3 changed files with 4 additions and 3 deletions

View File

@ -257,7 +257,7 @@ class Guest(models.Model):
last_name__iexact=self.last_name,
activity__date_start__gte=self.activity.date_start - one_year,
)
if qs.count() >= 5:
if qs.filter(entry__isnull=False).count() >= 5:
raise ValidationError(_("This person has been already invited 5 times this year."))
qs = qs.filter(activity=self.activity)