Commit 2abbcb94 authored by Luko van der Maas's avatar Luko van der Maas Committed by Sébastiaan Versteeg
Browse files

Merge branch 'feature/events-notification-default-url' into 'master'

Give event notification default url of event

See merge request !1275

(cherry picked from commit 7a202095)

4220570b Give event notification default url of event
parent a6d28c9b
import csv import csv
from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.admin import helpers from django.contrib.admin import helpers
from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admin.views.decorators import staff_member_required
...@@ -151,12 +152,14 @@ class EventMessage(FormView): ...@@ -151,12 +152,14 @@ class EventMessage(FormView):
def form_valid(self, form): def form_valid(self, form):
values = form.cleaned_data values = form.cleaned_data
if not values['url']:
values['url'] = settings.BASE_URL + self.event.get_absolute_url()
message = Message( message = Message(
title_nl=values['title_nl'], title_nl=values['title_nl'],
title_en=values['title_en'], title_en=values['title_en'],
body_nl=values['title_nl'], body_nl=values['title_nl'],
body_en=values['title_en'], body_en=values['title_en'],
url=values['url'] if values['url'] else None, url=values['url'],
category=Category.objects.get(key='event') category=Category.objects.get(key='event')
) )
message.save() message.save()
......
...@@ -94,4 +94,8 @@ class EventMessageForm(forms.Form): ...@@ -94,4 +94,8 @@ class EventMessageForm(forms.Form):
title_nl = forms.CharField(label=_('Title (NL)'), max_length=150) title_nl = forms.CharField(label=_('Title (NL)'), max_length=150)
body_en = forms.CharField(label=_('Body (EN)'), widget=forms.Textarea) body_en = forms.CharField(label=_('Body (EN)'), widget=forms.Textarea)
body_nl = forms.CharField(label=_('Body (NL)'), 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 "" ...@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-05-27 21:30+0200\n" "POT-Creation-Date: 2019-05-28 13:31+0200\n"
"PO-Revision-Date: 2019-05-27 21:31+0200\n" "PO-Revision-Date: 2019-05-28 13:31+0200\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n" "Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: nl\n" "Language: nl\n"
...@@ -154,6 +154,10 @@ msgstr "Bericht (EN)" ...@@ -154,6 +154,10 @@ msgstr "Bericht (EN)"
msgid "Body (NL)" msgid "Body (NL)"
msgstr "Bericht (NL)" msgstr "Bericht (NL)"
#: forms.py
msgid "The notification opens to the event by default."
msgstr "De notificatie opent standaard het evenement."
#: models.py #: models.py
msgid "Drinks" msgid "Drinks"
msgstr "Borrel" 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