mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-28 10:16:10 -06:00
This commit is contained in:
parent
66140fc017
commit
7033230388
@ -173,14 +173,17 @@ class NotificationGroup(ChangeLoggedModel):
|
|||||||
User.objects.filter(groups__in=self.groups.all())
|
User.objects.filter(groups__in=self.groups.all())
|
||||||
).order_by('username')
|
).order_by('username')
|
||||||
|
|
||||||
def notify(self, **kwargs):
|
def notify(self, object_type, object_id, **kwargs):
|
||||||
"""
|
"""
|
||||||
Bulk-create Notifications for all members of this group.
|
Bulk-create Notifications for all members of this group.
|
||||||
"""
|
"""
|
||||||
Notification.objects.bulk_create([
|
for user in self.members:
|
||||||
Notification(user=member, **kwargs)
|
Notification.objects.update_or_create(
|
||||||
for member in self.members
|
object_type=object_type,
|
||||||
])
|
object_id=object_id,
|
||||||
|
user=user,
|
||||||
|
defaults=kwargs
|
||||||
|
)
|
||||||
notify.alters_data = True
|
notify.alters_data = True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user