问题
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