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
forbidden_channels = [SMSChannel] # Never send via SMS
56
+
```
57
+
58
+
Forbidden channels take highest priority - they cannot be enabled even if specified in `default_channels`, `required_channels`, or user preferences.
59
+
60
+
## Defaults Channels
61
+
62
+
By default all channels are enabled for all users, and for all notifications types. Control which channels are enabled by default.
63
+
64
+
### Per-Channel Defaults
65
+
66
+
Disable a channel by default across all notification types:
67
+
68
+
```python
69
+
@register
70
+
classSMSChannel(BaseChannel):
71
+
key ="sms"
72
+
name ="SMS"
73
+
supports_realtime =True
74
+
supports_digest =False
75
+
enabled_by_default =False# Opt-in only - users must explicitly enable
76
+
```
77
+
78
+
### Per-NotificationType Defaults
79
+
80
+
By default all channels are enabled for every notification type. You can override channel defaults for specific notification types:
81
+
82
+
```python
83
+
@register
84
+
classMarketingEmail(NotificationType):
85
+
key ="marketing"
86
+
name ="Marketing Updates"
87
+
# Only enable email by default
88
+
# (users can still opt-in to enable other channels)
89
+
default_channels = [EmailChannel]
90
+
```
91
+
92
+
### Priority Order
93
+
94
+
The system determines enabled channels in this priority order:
95
+
96
+
1.**Forbidden channels** - Always disabled (cannot be overridden)
97
+
2.**Required channels** - Always enabled (cannot be disabled)
98
+
3.**User preferences** - Explicit user enable/disable choices (see [preferences.md](https://github.com/loopwerk/django-generic-notifications/tree/main/docs/preferences.md))
Copy file name to clipboardExpand all lines: docs/preferences.md
+14-5Lines changed: 14 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,11 @@
1
1
## User Preferences
2
2
3
-
By default every user gets notifications of all registered types delivered to every registered channel, but users can opt-out of receiving notification types, per channel.
3
+
By default, users receive notifications based on the channel defaults configured for each notification type and channel (see [customizing.md](https://github.com/loopwerk/django-generic-notifications/tree/main/docs/customizing.md)). Users can then customize their preferences by explicitly enabling or disabling specific channels for each notification type.
4
4
5
-
All notification types default to daily digest, except for `SystemMessage` which defaults to real-time. Users can choose different frequency per notification type.
5
+
The system supports both:
6
+
7
+
-**Channel preferences**: Enable/disable specific channels per notification type
8
+
-**Frequency preferences**: Choose between realtime delivery and digest delivery per notification type
6
9
7
10
This project doesn't come with a UI (view + template) for managing user preferences, but an example is provided in the [example app](#example-app).
0 commit comments