diff --git a/participants/utils/mailinglist_unsubscribe.py b/participants/utils/mailinglist_unsubscribe.py index ccce7b1..123b090 100644 --- a/participants/utils/mailinglist_unsubscribe.py +++ b/participants/utils/mailinglist_unsubscribe.py @@ -6,13 +6,12 @@ def get_mailinglist_unsubscribe_token(participant: Participant) -> UserToken: - try: - token = UserToken.objects.filter( - participant=participant, - type=UserToken.MAILINGLIST_UNSUBSCRIBE - ).first() + token = UserToken.objects.filter( + participant=participant, + type=UserToken.MAILINGLIST_UNSUBSCRIBE + ).first() - except UserToken.DoesNotExist: + if token is None: token = UserToken( participant=participant, type=UserToken.MAILINGLIST_UNSUBSCRIBE,