Set django-notification to be opt in rather than the default of opt out
I'm using django-notification to allow my users to opt out of certain alerts I generate in my web-application.
By default when I create a new notice type it is enabled rather than disabled In the users notification interface (checked)
I'd like to make some alerts opt-in rather than t开发者_StackOverflow社区he default of opt out. I've looked through the docs and been unable to see a way to do this, has anyone else managed to accomplish this?
Its automatically set based on the 'default' column in the type itself, by default e-mail is a sensitivity of 2, so if you set the default to your new notice type default '1' it will no longer set it on by default for your users, the default when creating new notice types is '2' which would allow it to be sent to everyone.
Looking at the code, the determining factor to sending the notice is a comparison between the 'default' column and the sensitivity filter NOTICE_MEDIA_DEFAULTS[medium].
Does this work
from notification import models as notification
notification.create_notice_type("friends_invite", "Invitation Received", "you have received an invitation", default=0)
精彩评论