From 964de92b9dc0f6f0aadfd881c353aed012391a43 Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 16 May 2022 21:38:56 +0200 Subject: [PATCH] Replace '$token' with login token in bulk messages --- shiftregister/team/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shiftregister/team/views.py b/shiftregister/team/views.py index 03563b9..be52c72 100644 --- a/shiftregister/team/views.py +++ b/shiftregister/team/views.py @@ -87,7 +87,13 @@ def bulk_message(request): try: Message.objects.bulk_create( ( - Message(text=form.cleaned_data["message"], to=helper) + Message( + text=form.cleaned_data["message"].replace( + "$token", + f"https://kontakt.rocks{helper.logintoken_set.first().get_absolute_url()}", + ), + to=helper, + ) for helper in Helper.objects.filter(number_validated=True) ) )