Skip to content
Snippets Groups Projects
Commit 1ac61db0 authored by Tomáš's avatar Tomáš
Browse files

add message flashing upon newsletter registration

parent c017ab5a
No related branches found
No related tags found
2 merge requests!699add message flashing upon newsletter registration,!698Add message flashing upon newsletter registration
Pipeline #11216 passed
......@@ -2,6 +2,7 @@ from functools import cached_property
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.contrib import messages
from django.core.paginator import Paginator
from django.db import models
from django.http import HttpResponseRedirect, JsonResponse
......@@ -290,6 +291,12 @@ class MainHomePage(
settings.PIRATICZ_NEWSLETTER_ID,
settings.PIRATICZ_NEWSLETTER_SOURCE,
)
messages.success(
request,
"Zkontroluj si prosím schránku, poslali jsme ti potvrzovací email."
)
try:
page = (
Page.objects.filter(id=form.cleaned_data["return_page_id"])
......@@ -299,6 +306,12 @@ class MainHomePage(
return HttpResponseRedirect(page.full_url)
except Page.DoesNotExist:
return HttpResponseRedirect(self.url)
messages.error(
request,
"Tvůj prohlížeč nám odeslal špatná data. Prosím, zkus to znovu."
)
return HttpResponseRedirect(self.url)
@route(r"^feeds/atom/$")
......
This diff is collapsed.
......@@ -24,6 +24,8 @@
</head>
<body>
{% include 'main/includes/layout/messages.html' %}
{% include 'main/includes/layout/header.html' %}
{% block content %}{% endblock content %}
......
{% if messages %}
<ul class="flex flex-col w-full drop-shadow-lg">
{% for message in messages %}
<li
class="px-5 py-4 text-center relative z-50 {% if message.tags == "debug" %}bg-grey-200{% elif message.tags == "info" %}bg-blue-300 text-white{% elif message.tags == "success" %}bg-green-400 text-white{% elif message.tags == "warning" %}bg-yellow-300{% elif message.tags == "error" %}bg-red-600 text-white{% endif %}"
>
<i
class="ico--{% if message.tags == "debug" %}cog{% elif message.tags == "info" %}info{% elif message.tags == "success" %}checkmark{% elif message.tags == "warning" %}warning{% elif message.tags == "error" %}cross{% endif %} mr-2"
></i>
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment