Don't crash when not logged in

This commit is contained in:
Midgard 2020-07-22 17:28:39 +02:00
parent cc5e3e3ecd
commit da7baed79c
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -36,6 +36,9 @@ class Event(models.Model):
def registration_of(self, user):
if not user.is_authenticated:
return None
registrations = self.eventregistration_set.filter(user=user).all()
if not registrations:
return None