mirror of
https://github.com/Hopiu/django-notifications.git
synced 2026-05-02 18:54:42 +00:00
Migrate to Django JSONField
This commit is contained in:
parent
6cc99d99b4
commit
b6b8b9d2ec
6 changed files with 43 additions and 8 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## 2.0.0
|
||||
- Added docker environment and migrated to Poetry and pyproject.toml
|
||||
- Added verbose_name migration
|
||||
- Migrated from jsonfield to Django JSONField
|
||||
|
||||
## 1.8.0
|
||||
|
||||
- Added support for Django 4.1
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ from django.utils import timezone
|
|||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.html import format_html
|
||||
|
||||
from jsonfield.fields import JSONField
|
||||
from model_utils import Choices
|
||||
from notifications import settings as notifications_settings
|
||||
from notifications.signals import notify
|
||||
|
|
@ -229,7 +228,7 @@ class AbstractNotification(models.Model):
|
|||
deleted = models.BooleanField(_('deleted'), default=False, db_index=True)
|
||||
emailed = models.BooleanField(_('emailed'), default=False, db_index=True)
|
||||
|
||||
data = JSONField(_('data'), blank=True, null=True)
|
||||
data = models.JSONField(_('data'), blank=True, null=True)
|
||||
|
||||
objects = NotificationQuerySet.as_manager()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from django.db import models, migrations
|
||||
import jsonfield.fields
|
||||
|
||||
|
||||
try:
|
||||
from jsonfield.fields import JSONField
|
||||
except ModuleNotFoundError:
|
||||
JSONField = models.JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
@ -13,7 +18,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='notification',
|
||||
name='data',
|
||||
field=jsonfield.fields.JSONField(null=True, blank=True),
|
||||
field=JSONField(null=True, blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@
|
|||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import jsonfield.fields
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
try:
|
||||
from jsonfield.fields import JSONField
|
||||
except ModuleNotFoundError:
|
||||
JSONField = models.JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
|
@ -64,7 +68,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AlterField(
|
||||
model_name="notification",
|
||||
name="data",
|
||||
field=jsonfield.fields.JSONField(
|
||||
field=JSONField(
|
||||
blank=True, null=True, verbose_name="data"
|
||||
),
|
||||
),
|
||||
|
|
|
|||
17
notifications/migrations/0010_alter_notification_data.py
Normal file
17
notifications/migrations/0010_alter_notification_data.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 4.2.1 on 2023-05-31 23:21
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("notifications", "0009_alter_notification_options_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="notification",
|
||||
name="data",
|
||||
field=models.JSONField(blank=True, null=True, verbose_name="data"),
|
||||
),
|
||||
]
|
||||
|
|
@ -4,7 +4,12 @@ from django.conf import settings
|
|||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import jsonfield.fields
|
||||
|
||||
|
||||
try:
|
||||
from jsonfield.fields import JSONField
|
||||
except ModuleNotFoundError:
|
||||
JSONField = models.JSONField
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
@ -32,7 +37,7 @@ class Migration(migrations.Migration):
|
|||
('public', models.BooleanField(db_index=True, default=True)),
|
||||
('deleted', models.BooleanField(db_index=True, default=False)),
|
||||
('emailed', models.BooleanField(db_index=True, default=False)),
|
||||
('data', jsonfield.fields.JSONField(blank=True, null=True)),
|
||||
('data', JSONField(blank=True, null=True)),
|
||||
('details', models.CharField(blank=True, max_length=64, null=True)),
|
||||
('action_object_content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notify_action_object', to='contenttypes.ContentType')),
|
||||
('actor_content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notify_actor', to='contenttypes.ContentType')),
|
||||
|
|
|
|||
Loading…
Reference in a new issue