python 2.7 - django-notifications: how NOTIFICATIONS_SOFT_DELETE=True works? -
i want notification system app, looking django package called django-notifications. understood of notification_soft_delete=true settings.
i mean when following:
from notifications import notify notify.send(user, recipient=user, verb='you reached level 10') this make entry database deleted=false if not wrong. have following in settings.py:
notifications_soft_delete=true which updates deleted=false deleted=true. don't know when change happens. there 1 api in documentation marks notifications deleted=true:
qs.mark_all_as_deleted() | qs.mark_all_as_deleted(recipient)
mark notifications in queryset (optionally filtered recipient) deleted=true. must used notifications_soft_delete=true.
but how mark notifications deleted??
here offical documents:
soft delete
by default,
delete/(?p<slug>\d+)/deletes specified notification record db. can change behaviour "mark notification.deleted field true" by:add settings.py:
notifications_soft_delete=trueoption, queryset methods unread , read contain 1 more filter: deleted=false. meanwhile, queryset methods deleted, active, mark_all_as_deleted, mark_all_as_active turned on. see more details in queryset methods section.
qs.mark_all_as_deleted() | qs.mark_all_as_deleted(recipient)mark notifications in queryset (optionally filtered recipient)
deleted=true. must usednotifications_soft_delete=true.
so, if want mark notifications deleted,you can either of these
- at frontend call api of
delete/(?p<slug>\d+)/ - at backend query notifications , call
mark_all_as_deleted()ormark_all_as_deleted(recipient)
Comments
Post a Comment