Commit 561c18ff authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'pushCheck' into 'master'

Add push notifications for newsletters

Closes #922

See merge request !1426
parents e7219730 023fb71a
...@@ -20,7 +20,9 @@ def send_newsletter(newsletter): ...@@ -20,7 +20,9 @@ def send_newsletter(newsletter):
Sends the newsletter as HTML and plaintext email Sends the newsletter as HTML and plaintext email
:param newsletter: the newsletter to be send :param newsletter: the newsletter to be send
""" """
events = None events = None
if newsletter.date: if newsletter.date:
datetime = ( datetime = (
......
...@@ -7,6 +7,7 @@ from django.utils import translation, timezone ...@@ -7,6 +7,7 @@ from django.utils import translation, timezone
from events.models import Event from events.models import Event
from newsletters import emails from newsletters import emails
from partners.models import Partner from partners.models import Partner
from pushnotifications.models import Message, Category
def write_to_file(pk, lang, html_message): def write_to_file(pk, lang, html_message):
...@@ -66,3 +67,11 @@ def send_newsletter(newsletter): ...@@ -66,3 +67,11 @@ def send_newsletter(newsletter):
emails.send_newsletter(newsletter) emails.send_newsletter(newsletter)
newsletter.sent = True newsletter.sent = True
newsletter.save() newsletter.save()
Message.objects.create(
title_nl=newsletter.title_nl,
title_en=newsletter.title_en,
body_nl="Tik om te bekijken",
body_en="Tap to view",
url=settings.BASE_URL + newsletter.get_absolute_url(),
category=Category.objects.get(key=Category.NEWSLETTER),
).send()
Supports Markdown
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