diff --git a/news1/db.sqlite3 b/news1/db.sqlite3
index a45eba5..ef1c6ad 100644
Binary files a/news1/db.sqlite3 and b/news1/db.sqlite3 differ
diff --git a/news1/news1/settings.py b/news1/news1/settings.py
index 353a30a..cefc0f0 100644
--- a/news1/news1/settings.py
+++ b/news1/news1/settings.py
@@ -39,6 +39,9 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'posts',
'rest_framework',
+ 'channels',
+ 'django_eventstream',
+
]
MIDDLEWARE = [
@@ -49,6 +52,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
+ 'django_grip.GripMiddleware'
]
ROOT_URLCONF = 'news1.urls'
@@ -71,6 +75,7 @@ TEMPLATES = [
]
WSGI_APPLICATION = 'news1.wsgi.application'
+ASGI_APPLICATION = 'news1.routing.application'
# Database
diff --git a/news1/posts/templates/posts/notice.html b/news1/posts/templates/posts/notice.html
index 58e6888..4af4b39 100644
--- a/news1/posts/templates/posts/notice.html
+++ b/news1/posts/templates/posts/notice.html
@@ -3,6 +3,7 @@
+
{% for notice in notices %}
{{ notice.notice_title }}
@@ -13,4 +14,13 @@
Neue Nachricht
Abmelden
-{% endblock %}
\ No newline at end of file
+
+
+
+
+{% endblock %}
diff --git a/news1/posts/views.py b/news1/posts/views.py
index c260a87..58f62eb 100644
--- a/news1/posts/views.py
+++ b/news1/posts/views.py
@@ -1,6 +1,7 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from django.views.decorators.csrf import csrf_exempt
+from django_eventstream import send_event
from rest_framework.parsers import JSONParser
from posts.forms import NoticeForm
@@ -27,6 +28,7 @@ def new(request):
pub_start=form.cleaned_data['start'],
pub_end=form.cleaned_data['end'])
newNotice.save()
+ send_event('notice', 'message', newNotice.id)
return redirect('index')
context = {'form': NoticeForm()}
return render(request, 'posts/edit.html', context)
@@ -36,6 +38,7 @@ def delete(request, deleteId=None):
delNotice= Notice.objects.get(id=deleteId)
if delNotice!= None:
delNotice.delete()
+ send_event('notice', 'message', deleteId)
return redirect('index')
@csrf_exempt
def notice_list(request):
diff --git a/news1/templates/base.html b/news1/templates/base.html
index f68622f..0678e17 100644
--- a/news1/templates/base.html
+++ b/news1/templates/base.html
@@ -1,6 +1,9 @@
+{% load static %}
+
+
@@ -60,4 +63,4 @@
-
\ No newline at end of file
+