openwisp-controller icon indicating copy to clipboard operation
openwisp-controller copied to clipboard

Replace third-party JSONField with Django's built-in JSONField

Open ssmadhavan006 opened this issue 3 weeks ago • 1 comments

Checklist

  • [x] I have read the OpenWISP Contributing Guidelines.
  • [x] I have manually tested the changes proposed in this pull request.
  • [x] I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • [ ] I have updated the documentation.

Reference to Existing Issue

Closes #1061.

Description of Changes

Replaced all remaining usages of the third-party jsonfield.JSONField with Django’s built-in JSONField.

The update includes:

  • Updating imports across all affected models to django.db.models.JSONField

  • Removing load_kwargs and dump_kwargs parameters that are no longer supported

  • Updating admin preview handling to correctly parse JSON values sent as strings

  • Including minimal schema-only AlterField migrations in both the config and connection apps

  • Adjusting tests where necessary to work with Django’s JSONField, which returns Python objects instead of formatted JSON strings

These changes remove reliance on the unmaintained jsonfield package and align the project with Django's native JSON handling while keeping full compatibility with existing data.

Screenshot

N/A

ssmadhavan006 avatar Dec 06 '25 06:12 ssmadhavan006

Hi @DragnEmperor , All CI blocking issues have now been resolved. This update corrects import ordering, applies full isort/black/flake8 formatting, fixes the failing test_device_put_api by flattening the payload and using native dicts/lists required by Django’s JSONField, updates JSONField-related tests in the connection module, reformats migration files to meet the 88-character limit, and aligns model/migration definitions (blank=True consistency). These changes ensure QA compliance and compatibility with Django’s native JSONField. All required fixes have been applied, Could you please trigger a CI rebuild when convenient?

ssmadhavan006 avatar Dec 10 '25 18:12 ssmadhavan006