Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions openwisp_notifications/base/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from jsonfield.fields import JSONField
from model_utils import Choices


Expand Down Expand Up @@ -91,7 +90,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()

Expand Down
4 changes: 1 addition & 3 deletions openwisp_notifications/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

logger = logging.getLogger(__name__)

EXTRA_DATA = app_settings.get_config()["USE_JSONFIELD"]

User = get_user_model()

Notification = load_model("Notification")
Expand Down Expand Up @@ -163,7 +161,7 @@ def notify_handler(**kwargs):
"%s_content_type" % opt,
ContentType.objects.get_for_model(obj),
)
if kwargs and EXTRA_DATA:
if kwargs:
notification.data = kwargs
notification.save()
notification_list.append(notification)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated migration to replace third-party JSONField with Django's built-in JSONField

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('openwisp_notifications', '0009_alter_notificationsetting_organization_and_more'),
]

operations = [
migrations.AlterField(
model_name='notification',
name='data',
field=models.JSONField(blank=True, null=True, verbose_name='data'),
),
]
1 change: 0 additions & 1 deletion openwisp_notifications/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

CONFIG_DEFAULTS = {
"PAGINATE_BY": 20,
"USE_JSONFIELD": True,
"SOFT_DELETE": False,
"NUM_TO_FETCH": 10,
"CACHE_TIMEOUT": 2,
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/1.2
openwisp-utils[rest,celery,channels] @ https://github.com/openwisp/openwisp-utils/tarball/1.2
markdown~=3.8.2
jsonfield>=2.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated migration to replace third-party JSONField with Django's built-in JSONField

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('sample_notifications', '0002_testapp'),
]

operations = [
migrations.AlterField(
model_name='notification',
name='data',
field=models.JSONField(blank=True, null=True, verbose_name='data'),
),
]
Loading