Add kaehmybot disable button

This commit is contained in:
Tommi S
2023-10-01 17:34:01 +03:00
parent e00323bffe
commit 6004156b6f
2 changed files with 10 additions and 1 deletions
+5 -1
View File
@@ -123,6 +123,7 @@ def submit(request, *args, **kwargs):
application = form.save() application = form.save()
custom_name = form.cleaned_data.get("custom_role_name") custom_name = form.cleaned_data.get("custom_role_name")
custom_is_board = form.cleaned_data.get("custom_role_is_board") custom_is_board = form.cleaned_data.get("custom_role_is_board")
kaehmybot_allowed = form.cleaned_data.get("kaehmybot")
if len(custom_name) > 0: if len(custom_name) > 0:
custom_role = CustomRole(name=custom_name, is_board=custom_is_board) custom_role = CustomRole(name=custom_name, is_board=custom_is_board)
@@ -141,7 +142,10 @@ def submit(request, *args, **kwargs):
send_email(to=to_email, subject=subject, body=message, html=True) send_email(to=to_email, subject=subject, body=message, html=True)
logging.debug(f"Sent kaehmy email to recipient <{to_email}>") logging.debug(f"Sent kaehmy email to recipient <{to_email}>")
processHooks(message=f"Uusi New kaehmy! {name} -> {url}", eventType="kaehmy") if kaehmybot_allowed or custom_is_board:
processHooks(
message=f"Uusi New kaehmy! {name} -> {url}", eventType="kaehmy"
)
else: else:
context = {"error": form.errors} context = {"error": form.errors}
return render(request, "kaehmy/error.html", context) return render(request, "kaehmy/error.html", context)
+5
View File
@@ -80,6 +80,11 @@
Hyväksyn <a href="https://static.sahkoinsinoorikilta.fi/GDPR/Tietosuojaseloste%20%E2%80%93%20Toimihenkil%C3%B6ksi%20hakemisen%20rekisteri.pdf" target="_blank">tietosuojaselosteen</a> ja tietojeni tallentamisen. Hyväksyn <a href="https://static.sahkoinsinoorikilta.fi/GDPR/Tietosuojaseloste%20%E2%80%93%20Toimihenkil%C3%B6ksi%20hakemisen%20rekisteri.pdf" target="_blank">tietosuojaselosteen</a> ja tietojeni tallentamisen.
{% endblocktrans %} {% endblocktrans %}
</span> </span>
<input type="checkbox" name="kaehmybot" value="1" checked>
<span>{% blocktrans %}
Kähmybot saa lähettää hakemuksestani viestin killan telegramiin (hallitusvirkoihin hakiessa valitse kyllä).
{% endblocktrans %}
</span>
{% buttons %} {% buttons %}
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
{% trans "Submit" %} {% trans "Submit" %}