Drop 'kind' field from Notification model

This commit is contained in:
Jeremy Stretch 2024-07-04 12:50:32 -04:00
parent 1c8118304f
commit 8065d7c127
4 changed files with 2 additions and 25 deletions

View File

@ -26,9 +26,9 @@ class NotificationSerializer(ValidatedModelSerializer):
class Meta:
model = Notification
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))
def get_object(self, instance):

View File

@ -152,22 +152,6 @@ class JournalEntryKindChoices(ChoiceSet):
# 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
class NotificationEventChoices(ChoiceSet):
key = 'Notification.event'

View File

@ -52,7 +52,6 @@ class Migration(migrations.Migration):
('created', models.DateTimeField(auto_now_add=True)),
('read', models.DateTimeField(null=True)),
('object_id', models.PositiveBigIntegerField()),
('kind', models.CharField(default='info', max_length=30)),
('event', models.CharField(max_length=30)),
('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)),

View File

@ -44,12 +44,6 @@ class Notification(models.Model):
ct_field='object_type',
fk_field='object_id'
)
kind = models.CharField(
verbose_name=_('kind'),
max_length=30,
choices=NotificationKindChoices,
default=NotificationKindChoices.KIND_INFO
)
event = models.CharField(
verbose_name=_('event'),
max_length=30,