Skip to content

Commit a9ad394

Browse files
committed
[change:radius] Replace third-party JSONField with Django built-in JSONField
- Replaced jsonfield.JSONField with Django's built-in JSONField in models - Updated RadiusBatch.user_credentials field - Updated OrganizationRadiusSettings.sms_meta_data field - Removed third-party jsonfield dependency from setup.py - Added migration to handle field type transition - Updated test migrations to use Django's JSONField - Ensured backward compatibility and data preservation - All existing tests pass with the new implementation Fixes #600
1 parent d2854e2 commit a9ad394

4 files changed

Lines changed: 36 additions & 6 deletions

File tree

openwisp_radius/base/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
from django.core.exceptions import ObjectDoesNotExist, ValidationError
1717
from django.core.mail import send_mail
1818
from django.db import models
19-
from django.db.models import ProtectedError, Q
19+
from django.db.models import JSONField, ProtectedError, Q
2020
from django.utils import timezone
2121
from django.utils.crypto import get_random_string
2222
from django.utils.timezone import now
2323
from django.utils.translation import gettext_lazy as _
24-
from jsonfield import JSONField
2524
from model_utils.fields import AutoLastModifiedField
2625
from phonenumber_field.modelfields import PhoneNumberField
2726
from private_storage.fields import PrivateFileField
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Generated by Django 5.2.5 on 2025-08-10 05:19
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("openwisp_radius", "0040_rename_phonetoken_index"),
10+
]
11+
12+
operations = [
13+
# Replace third-party JSONField with Django's built-in JSONField
14+
migrations.AlterField(
15+
model_name='radiusbatch',
16+
name='user_credentials',
17+
field=models.JSONField(
18+
blank=True,
19+
null=True,
20+
verbose_name='PDF',
21+
),
22+
),
23+
migrations.AlterField(
24+
model_name='organizationradiussettings',
25+
name='sms_meta_data',
26+
field=models.JSONField(
27+
blank=True,
28+
help_text='Additional configuration for SMS backend in JSON format (optional, leave blank if unsure)',
29+
null=True,
30+
verbose_name='SMS meta data',
31+
),
32+
),
33+
]

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"weasyprint>=65,<67",
4646
"dj-rest-auth>=6.0,<7.1",
4747
"django-sendsms~=0.5.0",
48-
"jsonfield~=3.1.0",
4948
"django-private-storage~=3.1.0",
5049
"django-ipware>=5.0,<7.1",
5150
"pyrad~=2.4",

tests/openwisp2/sample_radius/migrations/0002_initial_openwisp_app.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import django.core.validators
88
import django.db.models.deletion
99
import django.utils.timezone
10-
import jsonfield.fields
1110
import model_utils.fields
1211
import private_storage.fields
1312
import private_storage.storage.files
@@ -543,7 +542,7 @@ class Migration(migrations.Migration):
543542
),
544543
(
545544
"sms_meta_data",
546-
jsonfield.fields.JSONField(
545+
models.JSONField(
547546
blank=True,
548547
help_text=(
549548
"Additional configuration for SMS backend in JSON format"
@@ -695,7 +694,7 @@ class Migration(migrations.Migration):
695694
),
696695
(
697696
"user_credentials",
698-
jsonfield.fields.JSONField(
697+
models.JSONField(
699698
blank=True, null=True, verbose_name="PDF"
700699
),
701700
),

0 commit comments

Comments
 (0)