mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-05 06:46:25 -06:00
* Initial work on #15621 * Signal receiver should ignore models which don't support notifications * Flesh out NotificationGroup functionality * Add NotificationGroup filters for users & groups * Separate read & dimiss actions * Enable one-click dismissals from notifications list * Include total notification count in dropdown * Drop 'kind' field from Notification model * Register event types in the registry; add colors & icons * Enable event rules to target notification groups * Define dynamic choices for Notification.event_name * Move event registration to core * Add more job events * Misc cleanup * Misc cleanup * Correct absolute URLs for notifications & subscriptions * Optimize subscriber notifications * Use core event types when queuing events * Standardize queued event attribute to event_type; change content_type to object_type * Rename Notification.event_name to event_type * Restore NotificationGroupBulkEditView * Add API tests * Add view & filterset tests * Add model documentation * Fix tests * Update notification bell when notifications have been cleared * Ensure subscribe button appears only on relevant models * Notifications/subscriptions cannot be ordered by object * Misc cleanup * Add event icon & type to notifications table * Adjust icon sizing * Mute color of read notifications * Misc cleanup
This commit is contained in:
@@ -3,16 +3,17 @@ import re
|
||||
from django import forms
|
||||
from django.contrib.postgres.forms import SimpleArrayField
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from core.models import ObjectType
|
||||
from extras.choices import *
|
||||
from extras.models import *
|
||||
from netbox.forms import NetBoxModelImportForm
|
||||
from users.models import Group, User
|
||||
from utilities.forms import CSVModelForm
|
||||
from utilities.forms.fields import (
|
||||
CSVChoiceField, CSVContentTypeField, CSVModelChoiceField, CSVMultipleContentTypeField, SlugField,
|
||||
CSVChoiceField, CSVContentTypeField, CSVModelChoiceField, CSVModelMultipleChoiceField, CSVMultipleContentTypeField,
|
||||
SlugField,
|
||||
)
|
||||
|
||||
__all__ = (
|
||||
@@ -23,6 +24,7 @@ __all__ = (
|
||||
'EventRuleImportForm',
|
||||
'ExportTemplateImportForm',
|
||||
'JournalEntryImportForm',
|
||||
'NotificationGroupImportForm',
|
||||
'SavedFilterImportForm',
|
||||
'TagImportForm',
|
||||
'WebhookImportForm',
|
||||
@@ -247,3 +249,24 @@ class JournalEntryImportForm(NetBoxModelImportForm):
|
||||
fields = (
|
||||
'assigned_object_type', 'assigned_object_id', 'created_by', 'kind', 'comments', 'tags'
|
||||
)
|
||||
|
||||
|
||||
class NotificationGroupImportForm(CSVModelForm):
|
||||
users = CSVModelMultipleChoiceField(
|
||||
label=_('Users'),
|
||||
queryset=User.objects.all(),
|
||||
required=False,
|
||||
to_field_name='username',
|
||||
help_text=_('User names separated by commas, encased with double quotes')
|
||||
)
|
||||
groups = CSVModelMultipleChoiceField(
|
||||
label=_('Groups'),
|
||||
queryset=Group.objects.all(),
|
||||
required=False,
|
||||
to_field_name='name',
|
||||
help_text=_('Group names separated by commas, encased with double quotes')
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = NotificationGroup
|
||||
fields = ('name', 'description', 'users', 'groups')
|
||||
|
||||
Reference in New Issue
Block a user