mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 16:48:16 -06:00
Drop 'kind' field from Notification model
This commit is contained in:
parent
1c8118304f
commit
8065d7c127
@ -26,9 +26,9 @@ class NotificationSerializer(ValidatedModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Notification
|
model = Notification
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'object_type', 'object_id', 'object', 'user', 'created', 'read', 'kind', 'event',
|
'id', 'url', 'display', 'object_type', 'object_id', 'object', 'user', 'created', 'read', 'event',
|
||||||
]
|
]
|
||||||
brief_fields = ('id', 'url', 'display', 'object_type', 'object_id', 'user', 'kind', 'event')
|
brief_fields = ('id', 'url', 'display', 'object_type', 'object_id', 'user', 'event')
|
||||||
|
|
||||||
@extend_schema_field(serializers.JSONField(allow_null=True))
|
@extend_schema_field(serializers.JSONField(allow_null=True))
|
||||||
def get_object(self, instance):
|
def get_object(self, instance):
|
||||||
|
@ -152,22 +152,6 @@ class JournalEntryKindChoices(ChoiceSet):
|
|||||||
# Notifications
|
# Notifications
|
||||||
#
|
#
|
||||||
|
|
||||||
class NotificationKindChoices(ChoiceSet):
|
|
||||||
key = 'Notification.kind'
|
|
||||||
|
|
||||||
KIND_INFO = 'info'
|
|
||||||
KIND_SUCCESS = 'success'
|
|
||||||
KIND_WARNING = 'warning'
|
|
||||||
KIND_DANGER = 'danger'
|
|
||||||
|
|
||||||
CHOICES = [
|
|
||||||
(KIND_INFO, _('Info'), 'cyan'),
|
|
||||||
(KIND_SUCCESS, _('Success'), 'green'),
|
|
||||||
(KIND_WARNING, _('Warning'), 'yellow'),
|
|
||||||
(KIND_DANGER, _('Danger'), 'red'),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: Support dynamic entries from plugins
|
# TODO: Support dynamic entries from plugins
|
||||||
class NotificationEventChoices(ChoiceSet):
|
class NotificationEventChoices(ChoiceSet):
|
||||||
key = 'Notification.event'
|
key = 'Notification.event'
|
||||||
|
@ -52,7 +52,6 @@ class Migration(migrations.Migration):
|
|||||||
('created', models.DateTimeField(auto_now_add=True)),
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
('read', models.DateTimeField(null=True)),
|
('read', models.DateTimeField(null=True)),
|
||||||
('object_id', models.PositiveBigIntegerField()),
|
('object_id', models.PositiveBigIntegerField()),
|
||||||
('kind', models.CharField(default='info', max_length=30)),
|
|
||||||
('event', models.CharField(max_length=30)),
|
('event', models.CharField(max_length=30)),
|
||||||
('object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype')),
|
('object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype')),
|
||||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to=settings.AUTH_USER_MODEL)),
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to=settings.AUTH_USER_MODEL)),
|
||||||
|
@ -44,12 +44,6 @@ class Notification(models.Model):
|
|||||||
ct_field='object_type',
|
ct_field='object_type',
|
||||||
fk_field='object_id'
|
fk_field='object_id'
|
||||||
)
|
)
|
||||||
kind = models.CharField(
|
|
||||||
verbose_name=_('kind'),
|
|
||||||
max_length=30,
|
|
||||||
choices=NotificationKindChoices,
|
|
||||||
default=NotificationKindChoices.KIND_INFO
|
|
||||||
)
|
|
||||||
event = models.CharField(
|
event = models.CharField(
|
||||||
verbose_name=_('event'),
|
verbose_name=_('event'),
|
||||||
max_length=30,
|
max_length=30,
|
||||||
|
Loading…
Reference in New Issue
Block a user