safwanrahman / django-webpush

Web Push Notification Package for Django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Questions: is possible send notification when save models in admin interface

CARocha opened this issue · comments

Hi, it is possible to send a notification when I save a new record in my model, I use the django admin, I have tried to use signal to send the notification but it returns the following error!
WebPushException () takes no keyword arguments.
send me the notification but it takes and throws the error
example code: i have models name News
@receiver(post_save, sender=News)
def send_new_message_notification(sender, created, **kwargs):
message = kwargs['instance']
if created:
try:
obj = User.objects.get(pk=message.author.pk)
except sender.DoesNotExist:
pass
payload = {"head": "Welcome!", "body": message.title}
send_user_notification(user=obj, payload=payload, ttl=1000)

any help i will appreciate it
thank

Can you paste full tracelog?