We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5e49c8 commit 4f474fcCopy full SHA for 4f474fc
netbox/extras/models/notifications.py
@@ -173,14 +173,17 @@ def members(self):
173
User.objects.filter(groups__in=self.groups.all())
174
).order_by('username')
175
176
- def notify(self, **kwargs):
+ def notify(self, object_type, object_id, **kwargs):
177
"""
178
Bulk-create Notifications for all members of this group.
179
180
- Notification.objects.bulk_create([
181
- Notification(user=member, **kwargs)
182
- for member in self.members
183
- ])
+ for user in self.members:
+ Notification.objects.update_or_create(
+ object_type=object_type,
+ object_id=object_id,
184
+ user=user,
185
+ defaults=kwargs
186
+ )
187
notify.alters_data = True
188
189
0 commit comments