fixed invite link counting

This commit is contained in:
vabene1111 2022-01-17 15:16:13 +01:00
parent 745bb58c7e
commit 8a7c4e11c9

View File

@ -351,8 +351,8 @@ class InviteLinkForm(forms.ModelForm):
def clean(self): def clean(self):
space = self.cleaned_data['space'] space = self.cleaned_data['space']
if space.max_users != 0 and (UserPreference.objects.filter(space=space).count() + InviteLink.objects.filter( if space.max_users != 0 and (UserPreference.objects.filter(space=space).count() +
space=space).filter(valid_until__gte=datetime.today()).count()) >= space.max_users: InviteLink.objects.filter(valid_until__gte=datetime.today(), used_by=None, space=space).count()) >= space.max_users:
raise ValidationError(_('Maximum number of users for this space reached.')) raise ValidationError(_('Maximum number of users for this space reached.'))
def clean_email(self): def clean_email(self):