diff --git a/dasettings/forms.py b/dasettings/forms.py
index 54de4d8..e42b1b6 100644
--- a/dasettings/forms.py
+++ b/dasettings/forms.py
@@ -179,6 +179,20 @@ class UsersNotificationFormGroups(forms.ModelForm):
'group_rights_push',
]
+# Form für die Benachrichtigungseinstellungen Tätigkeitsbereiche
+class UsersNotificationFormTasks(forms.ModelForm):
+
+ class Meta:
+ model = UserNotifications
+ labels = {
+ "task_activity_mail" : "Tätigkeiten",
+
+ }
+ fields = [
+ 'task_activity_mail',
+ 'task_activity_push',
+ ]
+
# Form für die Benachrichtigungseinstellungen GRUPPEN
class UsersNotificationFormAgn(forms.ModelForm):
diff --git a/dasettings/templates/dasettings/notifications_content.html b/dasettings/templates/dasettings/notifications_content.html
index 75d5307..0028242 100644
--- a/dasettings/templates/dasettings/notifications_content.html
+++ b/dasettings/templates/dasettings/notifications_content.html
@@ -115,6 +115,43 @@
+
+
+
+
+
+
+
+
+
+ | Benachrichtigung |
+ E-Mail |
+ Push |
+
+
+
+ {% for formfield in notificationforms_task %}
+ {% if forloop.counter|divisibleby:2 %}
+ {{formfield}} |
+
+ {% else %}
+
+ | {{formfield.label_tag}} |
+ {{formfield}} |
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+
@@ -362,6 +399,7 @@
},
success: function( data )
{
+ console.log(data);
if(data['success']){
$('#notchange_done').toast('show');
}
diff --git a/dasettings/views.py b/dasettings/views.py
index 53451a0..54c7796 100644
--- a/dasettings/views.py
+++ b/dasettings/views.py
@@ -1,7 +1,7 @@
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect,HttpResponse, JsonResponse
-from .forms import UsersSelfChangeForm, UsersNotificationFormStandard, AgencyGroupPerms, AgencyModulsForm, UserNewUserForm, UserProfileForm, AgencyNetworkForm, AgencyOrganigrammForm, UserTimeForm, AbsenceReasonForm, UsersNotificationFormNews, UsersNotificationFormFiles, UsersNotificationFormMessages ,UsersNotificationFormOrganizer, UsersNotificationFormChat, UsersNotificationFormAbTime, UsersNotificationFormGroups, UsersNotificationFormAgn
+from .forms import UsersSelfChangeForm, UsersNotificationFormStandard, AgencyGroupPerms, AgencyModulsForm, UserNewUserForm, UserProfileForm, AgencyNetworkForm, AgencyOrganigrammForm, UserTimeForm, AbsenceReasonForm, UsersNotificationFormNews, UsersNotificationFormFiles, UsersNotificationFormMessages ,UsersNotificationFormOrganizer, UsersNotificationFormChat, UsersNotificationFormAbTime, UsersNotificationFormGroups, UsersNotificationFormAgn, UsersNotificationFormTasks
from django.contrib import messages
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.forms import PasswordChangeForm
@@ -58,33 +58,35 @@ def getAllForms(request, context):
# NOTIFICTAION FORMS
# STANDARDS
- notificationforms_standard = UsersNotificationFormStandard(instance=request.user.profile)
+ notificationforms_standard = UsersNotificationFormStandard(instance=request.user.usernotifications)
context.update({'notificationforms_standard' : notificationforms_standard})
- notificationforms_news = UsersNotificationFormNews(instance=request.user.profile)
+ notificationforms_news = UsersNotificationFormNews(instance=request.user.usernotifications)
context.update({'notificationforms_news' : notificationforms_news})
- notificationforms_files = UsersNotificationFormFiles(instance=request.user.profile)
+ notificationforms_files = UsersNotificationFormFiles(instance=request.user.usernotifications)
context.update({'notificationforms_files' : notificationforms_files})
- notificationforms_organizer = UsersNotificationFormOrganizer(instance=request.user.profile)
+ notificationforms_organizer = UsersNotificationFormOrganizer(instance=request.user.usernotifications)
context.update({'notificationforms_organizer' : notificationforms_organizer})
- notificationforms_messages = UsersNotificationFormMessages(instance=request.user.profile)
+ notificationforms_messages = UsersNotificationFormMessages(instance=request.user.usernotifications)
context.update({'notificationforms_messages' : notificationforms_messages})
- notificationforms_chat = UsersNotificationFormChat(instance=request.user.profile)
+ notificationforms_chat = UsersNotificationFormChat(instance=request.user.usernotifications)
context.update({'notificationforms_chat' : notificationforms_chat})
- notificationforms_abtime = UsersNotificationFormAbTime(instance=request.user.profile)
+ notificationforms_abtime = UsersNotificationFormAbTime(instance=request.user.usernotifications)
context.update({'notificationforms_abtime' : notificationforms_abtime})
- notificationforms_groups = UsersNotificationFormGroups(instance=request.user.profile)
+ notificationforms_groups = UsersNotificationFormGroups(instance=request.user.usernotifications)
context.update({'notificationforms_groups' : notificationforms_groups})
- notificationforms_agn = UsersNotificationFormAgn(instance=request.user.profile)
+ notificationforms_agn = UsersNotificationFormAgn(instance=request.user.usernotifications)
context.update({'notificationforms_agn' : notificationforms_agn})
+ notificationforms_task = UsersNotificationFormTasks(instance=request.user.usernotifications)
+ context.update({'notificationforms_task' : notificationforms_task})
@@ -205,32 +207,35 @@ def DASettings(request):
context.update({'passwordform' : passwordform})
############################### NOTIFIFORMS START ##########################################
- notificationforms_standard = UsersNotificationFormStandard(instance=request.user.profile)
+ notificationforms_standard = UsersNotificationFormStandard(instance=request.user.usernotifications)
context.update({'notificationforms_standard' : notificationforms_standard})
- notificationforms_news = UsersNotificationFormNews(instance=request.user.profile)
+ notificationforms_news = UsersNotificationFormNews(instance=request.user.usernotifications)
context.update({'notificationforms_news' : notificationforms_news})
- notificationforms_files = UsersNotificationFormFiles(instance=request.user.profile)
+ notificationforms_files = UsersNotificationFormFiles(instance=request.user.usernotifications)
context.update({'notificationforms_files' : notificationforms_files})
- notificationforms_organizer = UsersNotificationFormOrganizer(instance=request.user.profile)
+ notificationforms_organizer = UsersNotificationFormOrganizer(instance=request.user.usernotifications)
context.update({'notificationforms_organizer' : notificationforms_organizer})
- notificationforms_messages = UsersNotificationFormMessages(instance=request.user.profile)
+ notificationforms_messages = UsersNotificationFormMessages(instance=request.user.usernotifications)
context.update({'notificationforms_messages' : notificationforms_messages})
- notificationforms_chat = UsersNotificationFormChat(instance=request.user.profile)
+ notificationforms_chat = UsersNotificationFormChat(instance=request.user.usernotifications)
context.update({'notificationforms_chat' : notificationforms_chat})
- notificationforms_abtime = UsersNotificationFormAbTime(instance=request.user.profile)
+ notificationforms_abtime = UsersNotificationFormAbTime(instance=request.user.usernotifications)
context.update({'notificationforms_abtime' : notificationforms_abtime})
- notificationforms_groups = UsersNotificationFormGroups(instance=request.user.profile)
+ notificationforms_groups = UsersNotificationFormGroups(instance=request.user.usernotifications)
context.update({'notificationforms_groups' : notificationforms_groups})
- notificationforms_agn = UsersNotificationFormAgn(instance=request.user.profile)
- context.update({'notificationforms_agn' : notificationforms_agn})
+ notificationforms_agn = UsersNotificationFormAgn(instance=request.user.usernotifications)
+ context.update({'notificationforms_agn' : notificationforms_agn})
+
+ notificationforms_task = UsersNotificationFormTasks(instance=request.user.usernotifications)
+ context.update({'notificationforms_task' : notificationforms_task})
############################### NOTIFIFORMS END ############################################
# AGENCY UPDATE FORMS
diff --git a/users/models.py b/users/models.py
index ee1cae9..c7b9c37 100644
--- a/users/models.py
+++ b/users/models.py
@@ -337,6 +337,10 @@ class UserNotifications(models.Model):
message_received_mail = models.BooleanField(default=True)
message_received_push = models.BooleanField(default=True)
+ # TASKS
+ task_activity_mail = models.BooleanField(default=True)
+ task_activity_push = models.BooleanField(default=True)
+
# CHAT
# Diese Einstellung sorgt dafür, dass User eine Mail/Push erhalten, wenn neue Chatnachrichten vorhanden sind.
chat_received_mail = models.BooleanField(default=True)
diff --git a/users/signals.py b/users/signals.py
index accd667..a242b9d 100644
--- a/users/signals.py
+++ b/users/signals.py
@@ -113,10 +113,10 @@ def checkDefaultAbsenceReasons(sender, user, request, **kwargs):
FUNKTION ZUM SENDEN VON MAILS AUS EINEM SIGNAL
'''
-def sendMailNoti(notificationtext, user_touched):
+def sendMailNoti(notificationtext, user_touched, linktarget=""):
username = user_touched.first_name + " " + user_touched.last_name
- msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext})
+ msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext, 'linktarget' : linktarget})
send_mail(
'Agentur-Benachrichtigung',
'Hallo ' + user_touched.first_name + ' ' + user_touched.last_name + '! ' + notificationtext,
@@ -172,10 +172,6 @@ def adjust_group_notifications_permission(instance, action, reverse, model, pk_s
channel_layer = channels.layers.get_channel_layer()
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Der Gruppe " + group_touched.agencygroupname + " wurden Rechte entzogen."})
-
-
-
-
# Signal, wenn ein Nutzer aus der Gruppe entfernt/hinzugefügt wird
@receiver(signal=m2m_changed, sender=User.groups.through)
def adjust_group_notifications(instance, action, reverse, model, pk_set, using, *args, **kwargs):
@@ -235,158 +231,139 @@ def adjust_group_notifications(instance, action, reverse, model, pk_set, using,
)
-# SIGNAL FOR STANDARDS POST SAVE
+# SIGNALS FOR STANDARDS
+# DELETE
+@receiver(pre_delete, sender=Standards)
+def delete_standard(sender, instance, **kwargs):
+ usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
+ for user in usersofagency:
+ if(user.usernotifications.standard_delete_mail):
+ notificationtext = " es wurde ein neuer Agenturstandard gelöscht: " + instance.name
+ sendMailNoti(notificationtext, user)
+
+
+ if(user.usernotifications.standard_delete_push):
+ newnotification = UserNotification(touser=user, notificationtext="Agenturstandard gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
+ newnotification.save()
+
+ channel_layer = channels.layers.get_channel_layer()
+ async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Agenturstandard gelöscht: " + instance.name})
+
+# SAVE AND UPDATE
@receiver(post_save, sender=Standards)
def save_standard(sender, instance, **kwargs):
- GLOBALSENDMAILS = True
- # NEW STANDARD AND DIRECT PUBLIC
+ usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
+ targeturl = settings.BASE_URL + "standards/standard/" + str(instance.pk) + "/single"
+ # NEW STANDARD
if(kwargs["created"]):
- usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
-
- targeturl = settings.BASE_URL + "standards/standard/" + str(instance.pk) + "/single"
-
- if(instance.public):
-
+ if(instance.public):
for user in usersofagency:
- if(user.profile.agency_new_standard_mail):
- notificationtext = "Neuer Agenturstandard: " + instance.name
-
- username = user.first_name + " " + user.last_name
- msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext, 'linktarget' : targeturl})
+ if(user.usernotifications.standard_created_mail):
+ notificationtext = " es wurde ein neuer Agenturstandard erstellt: " + instance.name
+ sendMailNoti(notificationtext, user)
- if(GLOBALSENDMAILS):
- send_mail(
- 'Agentur-Benachrichtigung',
- 'Hallo ' + user.first_name + ' ' + user.last_name + '! ' + notificationtext,
- 'noreply@digitale-agentur.com',
- [user.email],
- html_message=msg_html,
- fail_silently=True
- )
- if(user.profile.agency_new_standard_push):
+ if(user.usernotifications.standard_created_push):
newnotification = UserNotification(touser=user, notificationtext="Neuer Agenturstandard: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
newnotification.save()
+
+ channel_layer = channels.layers.get_channel_layer()
+ async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Neuer Agenturstandard: " + instance.name})
else:
for user in usersofagency:
- if(user.has_perm("users.standardmanager")):
+ if(user.has_perm("users.standardmanager") and user.usernotifications.standard_created_unpub_push):
newnotification = UserNotification(touser=user, notificationtext="Neuer unveröffentlichter Agenturstandard: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
newnotification.save()
+
+ channel_layer = channels.layers.get_channel_layer()
+ async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Neuer unveröffentlichter Agenturstandard: " + instance.name})
+
+ if(user.has_perm("users.standardmanager") and user.usernotifications.standard_created_unpub_mail):
+ notificationtext = " es wurde ein neuer unveröffentlichter Agenturstandard erstellt: " + instance.name
+ sendMailNoti(notificationtext, user)
+ # Standard wurde aktualisiert
else:
- channel_layer = channels.layers.get_channel_layer()
- async_to_sync(channel_layer.group_send)("agency_" + str(instance.agency.pk), {'type' : 'update_standard'})
+ for user in usersofagency:
+
+ if(user.usernotifications.standard_update_mail):
+ notificationtext = " es wurde ein neuer Agenturstandard aktualisiert: " + instance.name
+ sendMailNoti(notificationtext, user)
+
+ if(user.usernotifications.standard_update_push):
+ newnotification = UserNotification(touser=user, notificationtext="Agenturstandard aktualisiert: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
+ newnotification.save()
+
+ channel_layer = channels.layers.get_channel_layer()
+ async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Agenturstandard aktualisiert: " + instance.name})
+
# SIGNAL FOR NEWS
@receiver(post_save, sender=News)
def save_news(sender, instance, **kwargs):
- GLOBALSENDMAILS = True
if(kwargs["created"]):
- # Hier wird an alle in der Agentur geschickt, lokal wird geprüft, ob der User diese Push-Info haben will
- channel_layer = channels.layers.get_channel_layer()
- async_to_sync(channel_layer.group_send)("agency_" + str(instance.agency.pk), {'type' : 'agency_newnews', 'pushtext' : "Neue Agenturnews | " + instance.name})
-
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
-
targeturl = settings.BASE_URL + "news/news/" + str(instance.pk) + "/single"
# Prüfung, ob die News SOFORT online geht oder später
if(instance.go_online_on < timezone.now() and instance.agnotify):
for user in usersofagency:
-
- if(user.profile.news_mail):
- notificationtext = "Neue Agenturnews: " + instance.name
-
- username = user.first_name + " " + user.last_name
- msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext, 'linktarget' : targeturl})
-
-
- if(GLOBALSENDMAILS):
- send_mail(
- 'Agentur-Benachrichtigung',
- 'Hallo ' + user.first_name + ' ' + user.last_name + '! ' + notificationtext,
- 'noreply@digitale-agentur.com',
- [user.email],
- html_message=msg_html,
- fail_silently=True
- )
+ if(user.usernotifications.news_created_mail):
+ notificationtext = " es gibt neue Agenturnews: " + instance.name
+ sendMailNoti(notificationtext, user, targeturl)
- if(user.profile.news_push):
- newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="agencynews", elementid=instance.pk)
+
+ if(user.usernotifications.news_created_push):
+ newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="", elementid=instance.pk)
newnotification.save()
-
-
+ channel_layer = channels.layers.get_channel_layer()
+ async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__News | Neue Agenturnews: " + instance.name})
else:
- instance.agnotify = False
+ instance.agnotify = False
instance.save()
- # News wurden aktualisiert
- else:
- pass
- # Hier wird an alle in der Agentur geschickt, lokal wird geprüft, ob der User diese Push-Info haben will
- #channel_layer = channels.layers.get_channel_layer()
- #async_to_sync(channel_layer.group_send)("agency_" + str(instance.agency.pk), {'type' : 'agency_newnews', 'pushtext' : "Neue Agenturnews | " + instance.name})
-
-
+
# SIGNALS FOR TASK
@receiver(signal=m2m_changed, sender=Tasks.usersfield.through)
def adjust_group_notifications_task(instance, action, reverse, model, pk_set, using, *args, **kwargs):
- # IF FALSE NO MAILS WILL BE SEND - IN PRODUCTIVITY CHANGE TO TRUE #
- GLOBALSENDMAILS = True
-
# A USER WAS TOUCHED ATT HIS TASKS
user_touched = User.objects.get(pk=list(pk_set)[0])
taskname = instance.name
# PUSH NOTIFICATION FOR GROUOPCHANGES
- if(user_touched.profile.add_task_push):
+ if(user_touched.usernotifications.task_activity_push):
if(action == 'post_remove'):
newnotification = UserNotification(touser=user_touched, notificationtext="Sie wurden von der Tätigkeit " + taskname + " entfernt.", notificationtype="taskchange")
newnotification.save()
+
+ channel_layer = channels.layers.get_channel_layer()
+ async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Tätigkeitsbereich | Sie wurden von der Tätigkeitn " + instance.name + " entfernt."})
+
# A USER WAS ADDED TO A GROUP
elif(action == 'post_add'):
newnotification = UserNotification(touser=user_touched, notificationtext="Sie wurden der Tätigkeit " + taskname + " zugeordnet.", notificationtype="taskchange")
newnotification.save()
+ channel_layer = channels.layers.get_channel_layer()
+ async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Tätigkeitsbereich | Sie wurden der Tätigkeitn " + instance.name + " zugeordnet."})
+
# E-MAILNOTIFICATIONS FOR GROUPCHANGES
- if(user_touched.profile.add_task_mail):
+ if(user_touched.usernotifications.task_activity_mail):
notificationtext = ""
if(action == 'post_remove'):
notificationtext = "Sie wurden von der Tätigkeit " + taskname + " entfernt."
-
- username = user_touched.first_name + " " + user_touched.last_name
- msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext})
- if(GLOBALSENDMAILS):
- send_mail(
- 'Agentur-Benachrichtigung',
- 'Hallo ' + user_touched.first_name + ' ' + user_touched.last_name + '! ' + notificationtext,
- 'noreply@digitale-agentur.com',
- [user_touched.email],
- html_message=msg_html,
- fail_silently=True
- )
+ sendMailNoti(notificationtext, user_touched)
# A USER WAS ADDED TO A GROUP
elif(action == 'post_add'):
notificationtext = "Sie wurden der Tätigkeit " + taskname + " zugeordnet."
-
- username = user_touched.first_name + " " + user_touched.last_name
- msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext})
- if(GLOBALSENDMAILS):
- send_mail(
- 'Agentur-Benachrichtigung',
- 'Hallo ' + user_touched.first_name + ' ' + user_touched.last_name + '! ' + notificationtext,
- 'noreply@digitale-agentur.com',
- [user_touched.email],
- html_message=msg_html,
- fail_silently=True
- )
+ sendMailNoti(notificationtext, user_touched)
@receiver(signal=post_save, sender=AgencyNetworkPreperation)
def save_agjoin_prep(sender, instance, **kwargs):
@@ -427,8 +404,7 @@ def update_presence_live(sender, **kwargs):
'''
- ABWESENHEIT BERECHNUNG UND SPEICHERUNG DER NEUEN URLAUBSTAGE - VERWEIS AUF timemenagement.views
-
+ ABWESENHEIT BERECHNUNG UND SPEICHERUNG DER NEUEN URLAUBSTAGE - VERWEIS AUF timemenagement.views
'''
@receiver(signal=post_save, sender=Absence)
diff --git a/users/templates/users/base.html b/users/templates/users/base.html
index f2d8273..164a5a1 100644
--- a/users/templates/users/base.html
+++ b/users/templates/users/base.html
@@ -717,8 +717,6 @@ $(document).ready(function(){
//HANDLER FOR ALL PUSHNOTIFICATIONS
if(e["data"].split("__")[0] == "pushnotification"){
- console.log(e["data"].split("__"))
-
var notify = new Notification('Digitale Agentur', {
body: e["data"].split("__")[1]
});
@@ -808,7 +806,7 @@ window.onerror = function (msg, url, line) {
Notification.requestPermission().then(function(p) {
if(p === 'granted') {
// show notification here
- console.log("OK!")
+ console.log("User receive notifications.")
} else {
console.log('User blocked notifications.');
}
diff --git a/users/views.py b/users/views.py
index 449362e..7d1e7fb 100644
--- a/users/views.py
+++ b/users/views.py
@@ -48,6 +48,7 @@ from django.db.models.signals import m2m_changed
from django.contrib.auth.models import User, Group
from users.signals import adjust_group_notifications_permission
+
def randomString(stringLength=10):
"""Generate a random string of fixed length """
letters = string.ascii_lowercase
@@ -881,12 +882,12 @@ def cronactions(request, code):
allusers = User.objects.all()
for news in all_unnotifc_news:
targeturl = settings.BASE_URL + "news/news/" + str(news.pk) + "/single"
-
+ # NEW NEWS FOUND WHICH HAVE TO GO ONLINE NOW!
news.agnotify = True
news.save()
-
for user in allusers:
- if(user.profile.news_mail and news.agency == user.profile.agency):
+ # SEMI-SIGNAL FOR NEWS GOING ONLINE
+ if(user.usernotifications.news_created_mail and news.agency == user.profile.agency):
notificationtext = "Neue Agenturnews: " + news.name
username = user.first_name + " " + user.last_name
msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext, 'linktarget' : targeturl})
@@ -899,9 +900,14 @@ def cronactions(request, code):
fail_silently=True
)
- if(user.profile.news_push and news.agency == user.profile.agency):
+ if(user.usernotifications.news_created_push and news.agency == user.profile.agency):
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + news.name, notificationtype="agencynews", elementid=news.pk)
newnotification.save()
+
+ channel_layer = channels.layers.get_channel_layer()
+ async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__News | Neue Agenturnews: " + news.name})
+
+
else:
print("API CODE FAILED")
data.update({"status" : "failed"})