Adding custom field to django-notifications always returning none on notify.send()

十年热恋 提交于 2021-01-29 18:31:29

问题


I am trying to add a new field to the Notification model in django-notifications-hq. Currently in my main/models.py i have:

class Notification(AbstractNotification):
    # custom field example
    unique_uuid = models.CharField(max_length=255,unique=True, null=True)

    class Meta(AbstractNotification.Meta):
        abstract = False
        app_label = 'main'

Now in my settings.py file I have:

NOTIFICATIONS_NOTIFICATION_MODEL = 'main.Notification'
NOTIFICATIONS_USE_JSONFIELD=True

I am trying to generate a notification in my views.py by using:

notify.send(sender=user, recipient=post.author, verb=message, target=post, \
                        unique_uuid = notification_create_uuid(...))

However, the notification is not being created correctly and the field is returning "None". How can I set this field in notify.send(), so that the notification is created with that field set?

来源:https://stackoverflow.com/questions/64249745/adding-custom-field-to-django-notifications-always-returning-none-on-notify-send

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!