Skip to content
Snippets Groups Projects
Verified Commit fe8cf0a9 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Use email code from core

parent 2960ba1f
No related branches found
No related tags found
1 merge request!55WIP: Resolve "Migrate to AlekSIS app"
Pipeline #3846 failed
{% load i18n %}
{% block subject %} {% trans "New event" %} {{ new_event }} {% endblock %}
{% block plain %}
{% blocktrans with new_event=new_event %} An event was created: {{ new_event }}{% endblocktrans %}
* {% trans "Group" %}: {{ new_event.group }}
* {% trans "Description" %}: {{ new_event.description }}
* {% trans "Published" %}: {{ new_event.published }}
* {% trans "Place" %}: {{ new_event.place }}
* {% trans "Date of event" %}: {{ new_event.date_event }}
* {% trans "Registration deadline" %}: {{ new_event.date_registration }}
* {% trans "Retraction deadline" %}: {{ new_event.date_retraction }}
* {% trans "Cost" %}: {{ new_event.cost }}
* {% trans "Max. participants" %}: {{ new_event.max_participants }}
* {% trans "Owners" %}:
{% for owner in new_event.group.owners.all() %}
* {{ owner }}
{% endfor %}
* {% trans "Feedback aspects" %}:
{% for aspect in new_event.feedback_aspects.all() %}
* {{ aspect }}
{% endfor %}
{% blocktrans with sender=person %}
The event was created by {{ sender }}
{% endblocktrans %}
{% trans "Your AlekSIS team" %}
{% endblock %}
{% block html %}
<main>
<p>{% blocktrans with new_event=new_event %} An event was created: {{ new_event }}{% endblocktrans %}</p>
<blockquote>
<h5>{{ new_event }}</h5>
<ul>
<li> {% trans "Group" %}: {{ new_event.group }}</li>
<li> {% trans "Description" %}: {{ new_event.description }}</li>
<li> {% trans "Published" %}: {{ new_event.published }}</li>
<li> {% trans "Place" %}: {{ new_event.place }}</li>
<li> {% trans "Date of event" %}: {{ new_event.date_event }}</li>
<li> {% trans "Registration deadline" %}: {{ new_event.date_registration }}</li>
<li> {% trans "Retraction deadline" %}: {{ new_event.date_retraction }}</li>
<li> {% trans "Cost" %}: {{ new_event.cost }}</li>
<li> {% trans "Max. participants" %}: {{ new_event.max_participants }}</li>
<li> {% trans "Owners" %}</li>
<ul>
{% for owner in new_event.group.owners.all() %}
<li> {{ owner }}</li>
{% endfor %}
</ul>
<li> {% trans "Feedback aspects" %}</li>
<ul>
{% for aspect in new_event.feedback_aspects.all() %}
<li> {{ aspect }}</li>
{% endfor %}
</ul>
</ul>
</blockquote>
<p>
{% blocktrans with sender=person %}
The event was created by {{ sender }}
{% endblocktrans %}
</p>
<p>
<i>{% trans "Your AlekSIS team" %}</i>
</p>
</main>
{% endblock %}
{% load i18n %}
{% block subject %} {% trans "New registration" %} {{ registration }} {% endblock %}
{% block plain %}
{% blocktrans with new_event=new_event %}New registration: {{ event }}{% endblocktrans %}
*** {% trans "Event" %} *****
* {% trans "Event" %}: {{ registration.event }}
**** {% trans "Person " %} ****
* {% trans "Name" %}: {{ registration.person }}
* {% trans "Date of birth" %}: {{ registration.date_of_birth }}
* {% trans "Email address" %}: {{ registration.person.email }}
* {% trans "Mobile number" %}: {{ registration.person.mobile_number }}
* {% trans "Street" %}: {{ registration.person.street }}
* {% trans "Housenumber" %}: {{ registration.person.housenumber }}
* {% trans "Postal code" %}: {{ registration.person.postal_code }}
* {% trans "Place" %}: {{ registration.person.place }}
**** {% trans "Guardian" %} ****
* {% trans "Name" %}: {{ registration.person.guardians.first }}
* {% trans "Email address" %}: {{ registration.person.guardians.first.email }}
* {% trans "Mobile number" %}: {{ registration.person.guardians.first.mobile_number }}
**** {% trans "Financial details" %}
* {% trans "Donation" %}: {{ registration.donation }}
{% if registration.iban %}
* {% trans "Accept SEPA" %}: {{ registration.accept_sepa }}
* {% trans "IBAN" %}: {{ registration.iban }}
{% endif %}
**** {% trans "Declarations" %} ****
* {% trans "Consent by parents" %}: {{ registration.accept_terms }}
* {% trans "Data protection" %}: {{ registration.accept_data }}
* {% trans "Terms and conditions" %}: {{ registration.accept_general_terms }}
{% trans "Your AlekSIS team" %}
{% endblock %}
{% block html %}
<main>
<p>{% blocktrans with new_event=new_event %}New registration: {{ registration}}{% endblocktrans %}</p>
<blockquote>
<h5>{% trans "Event" %}</h5>
<ul>
<li>{% trans "Event" %}: {{ registration.event }}</li>
</ul>
<h5>{% trans "Person " %</h5>
<ul>
<li>{% trans "Name" %}: {{ registration.person }}</li>
<li>{% trans "Date of birth" %}: {{ registration.date_of_birth }}</li>
<li>{% trans "Email address" %}: {{ registration.person.email }}</li>
<li>{% trans "Mobile number" %}: {{ registration.person.mobile_number }}</li>
<li>{% trans "Street" %}: {{ registration.person.street }}</li>
<li>{% trans "Housenumber" %}: {{ registration.person.housenumber }}</li>
<li>{% trans "Postal code" %}: {{ registration.person.postal_code }}</li>
<li>{% trans "Place" %}: {{ registration.person.place }}</li>
</ul>
<h5>{% trans "Guardian" %}</h5>
<ul>
<li>{% trans "Name" %}: {{ registration.person.guardians.first }}</li>
<li>{% trans "Email address" %}: {{ registration.person.guardians.first.email }}</li>
<li>{% trans "Mobile number" %}: {{ registration.person.guardians.first.mobile_number }}</li>
</ul>
<h5>{% trans "Financial details" %}</h5>
<ul>
<li>{% trans "Donation" %}: {{ registration.donation }}</li>
{% if registration.iban %}
<li>{% trans "Accept SEPA" %}: {{ registration.accept_sepa }}</li>
<li>{% trans "IBAN" %}: {{ registration.iban }}</li>
{% endif %}
</ul>
<h5>{% trans "Declarations" %}</h5>
<ul>
<li>{% trans "Consent by parents" %}: {{ registration.accept_terms }}</li>
<li>{% trans "Data protection" %}: {{ registration.accept_data }}</li>
<li>{% trans "Terms and conditions" %}: {{ registration.accept_general_terms }}</li>
</ul>
</blockquote>
<p>
<i>{% trans "Your AlekSIS team" %}</i>
</p>
</main>
{% endblock %}
......@@ -13,6 +13,7 @@ import pytz
import reversion
from django_tables2 import RequestConfig
from rules.contrib.views import permission_required
from templated_email import send_templated_email
from aleksis.core.models import Activity, Person
from aleksis.core.util import messages
......@@ -198,21 +199,20 @@ def register_event(request, id_):
else:
messages.error(request, _("You entered an invalid voucher code!"))
# Produce e-mail
message = EmailMessage()
message.reply_to = (request.user.person.mail,)
message.to = [
"orga@teckids.org",
]
message.subject = _("New event:") % (event,)
message.extra_headers = {
"X-OTRS-CustomerUser": request.user.person.user.username,
}
message.body = ""
message.body += form_to_text_table(edit_event_form, 78)
# Send message
message.send()
send_templated_email(
template_name="event_registred",
from_email=lazy_preference("mail", "address"),
recipient_list=[
"orga@teckids.org"
],
headers = {
"reply_to": [
request.person.email,
request.person.guardians.first().email,
],
},
context=context,
)
messages.success(
request,
......@@ -330,8 +330,19 @@ def edit_event(request: HttpRequest, id_: Optional[int] = None) -> HttpResponse:
if request.method == "POST":
if edit_event_form.is_valid():
with reversion.create_revision():
edit_event_form.save(commit=True)
new_event = edit_event_form.save(commit=True)
if not event:
context["new_event"] = new_event
context["person"] = request.user.person
send_templated_email(
template_name="event_created",
from_email=lazy_preference("mail", "address"),
recipient_list=[
"orga@teckids.org"
],
context=context,
)
messages.success(request, _("The event has been saved."))
return redirect("events")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment