You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: