Verified Commit 4220570b authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Give event notification default url of event

parent 3ee093de
import csv
from django.conf import settings
from django.contrib import messages
from django.contrib.admin import helpers
from django.contrib.admin.views.decorators import staff_member_required
......@@ -151,12 +152,14 @@ class EventMessage(FormView):
def form_valid(self, form):
values = form.cleaned_data
if not values['url']:
values['url'] = settings.BASE_URL + self.event.get_absolute_url()
message = Message(
title_nl=values['title_nl'],
title_en=values['title_en'],
body_nl=values['title_nl'],
body_en=values['title_en'],
url=values['url'] if values['url'] else None,
url=values['url'],
category=Category.objects.get(key='event')
)
message.save()
......
......@@ -94,4 +94,8 @@ class EventMessageForm(forms.Form):
title_nl = forms.CharField(label=_('Title (NL)'), max_length=150)
body_en = forms.CharField(label=_('Body (EN)'), widget=forms.Textarea)
body_nl = forms.CharField(label=_('Body (NL)'), widget=forms.Textarea)
url = forms.CharField(max_length=256, required=False)
url = forms.CharField(
max_length=256,
required=False,
help_text=_('The notification opens to the event by default.')
)
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-27 21:30+0200\n"
"PO-Revision-Date: 2019-05-27 21:31+0200\n"
"POT-Creation-Date: 2019-05-28 13:31+0200\n"
"PO-Revision-Date: 2019-05-28 13:31+0200\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n"
"Language-Team: \n"
"Language: nl\n"
......@@ -154,6 +154,10 @@ msgstr "Bericht (EN)"
msgid "Body (NL)"
msgstr "Bericht (NL)"
#: forms.py
msgid "The notification opens to the event by default."
msgstr "De notificatie opent standaard het evenement."
#: models.py
msgid "Drinks"
msgstr "Borrel"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment