Display a form error rather than a page error if a guest is already invited
This commit is contained in:
parent
1186b0f9a9
commit
b16871d925
3 changed files with 4 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue