Skip to content

[chores:fix] Removed deprecated UUIDAdmin in favour of CopyableFieldsAdmin#295

Merged
nemesifier merged 1 commit into
masterfrom
fix-deprecated-uuid-admin
May 15, 2026
Merged

[chores:fix] Removed deprecated UUIDAdmin in favour of CopyableFieldsAdmin#295
nemesifier merged 1 commit into
masterfrom
fix-deprecated-uuid-admin

Conversation

@nemesifier

Copy link
Copy Markdown
Member

Removed deprecated UUIDAdmin in favour of CopyableFieldsAdmin.

Needed due to openwisp/openwisp-utils#551.

Checklist

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

@nemesifier nemesifier self-assigned this May 15, 2026
@nemesifier nemesifier added the dependencies Pull requests that update a dependency file label May 15, 2026
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Rate limit exceeded

@nemesifier has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 58 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b841d1aa-d292-4220-b338-516e99484987

📥 Commits

Reviewing files that changed from the base of the PR and between 4d44786 and 95cdf80.

📒 Files selected for processing (1)
  • openwisp_network_topology/admin.py
📝 Walkthrough

Walkthrough

This PR migrates openwisp-network-topology from third-party jsonfield library to Django's native JSONField with DjangoJSONEncoder. Node and Link models' JSON field definitions are updated, and query logic is rewritten to use Cast(..., TextField()) for substring matching instead of JSON containment operators. Admin search is enhanced with get_search_results overrides that annotate helper fields for full-text searching. Database migrations alter the schema for all affected fields, and tests are updated to use field-level property queries and the new get_from_address lookup pattern.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

enhancement


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Bug Fixes ❌ Error PR fixes bug #253 (JSONField migration) affecting Node/Link lookups. Updated existing tests but no NEW regression tests were added to verify the bug fix or demonstrate it fails without the patch. Add explicit regression tests demonstrating the bug fix. Enhance upgrade test to validate legacy JSON string fields convert properly.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing deprecated UUIDAdmin and replacing it with CopyableFieldsAdmin, which is the primary focus across the changeset.
Description check ✅ Passed The description covers the main change and references the related dependency issue. However, the checklist marks test updates as not done, and the description is relatively brief without detailed explanation of the broader JSONField migration context visible in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-deprecated-uuid-admin

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kilo-code-bot

kilo-code-bot Bot commented May 15, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR successfully migrates from deprecated UUIDAdmin to CopyableFieldsAdmin and removes the D3.js license mention from the README (no longer bundled).

Key Changes Reviewed

File Change Assessment
admin.py UUIDAdminCopyableFieldsAdmin ✅ Correct usage with copyable_fields = ["uuid"]
admin.py JSON search with Cast annotation ✅ Proper approach for cross-database JSON text search
base/node.py JSONField migration ✅ Uses default=list (callable) for mutable default
base/link.py JSONField migration ✅ Uses default=dict (callable) for mutable default
migrations/ Database migrations ✅ Proper AlterField operations with DjangoJSONEncoder
tests/ Updated JSON queries ✅ Uses native Django JSON field lookups (properties__ht=True)
.github/workflows/ New bot automation workflows ✅ Standard reusable workflow patterns from openwisp-utils
README.rst Remove D3.js license mention ✅ Accurate - D3.js no longer bundled

Incremental Changes (since previous review at 869c109)

Latest commit (95cdf80) includes only cosmetic changes:

  • Import order reorganization in admin.py
  • Multi-line formatting for TopologyAdmin class inheritance

No functional changes - all previous assessments remain valid.

Technical Details

  1. Admin Search Implementation: The get_search_results methods using Cast("addresses", output_field=TextField()) is the correct cross-database approach for searching JSON fields as text.

  2. JSONField Migration: The switch from jsonfield.JSONField to models.JSONField with encoder=DjangoJSONEncoder properly handles datetime serialization while maintaining compatibility.

  3. Mutable Defaults: Using default=list and default=dict (callables) instead of default=[] and default={} prevents the common Python mutable default argument bug.

  4. Query Updates: The test updates from properties__contains to properties__ht=True style queries leverage Django's native JSON field lookups, which is the correct approach for the native JSONField.

Migration Safety

The migration files properly alter existing fields without data loss. The AlterField operations maintain the same column structure while updating the Django field type.

Files Reviewed (14 files)
  • openwisp_network_topology/admin.py
  • openwisp_network_topology/base/link.py
  • openwisp_network_topology/base/node.py
  • openwisp_network_topology/integrations/device/tests/test_wifi_mesh.py
  • openwisp_network_topology/management/commands/upgrade_from_django_netjsongraph.py
  • openwisp_network_topology/migrations/0017_migrate_to_django_jsonfield.py
  • openwisp_network_topology/tests/test_link.py
  • openwisp_network_topology/tests/test_topology.py
  • tests/openwisp2/sample_network_topology/migrations/0005_migrate_to_django_jsonfield.py
  • .github/workflows/bot-autoassign-issue.yml
  • .github/workflows/bot-autoassign-pr-issue-link.yml
  • .github/workflows/bot-autoassign-pr-reopen.yml
  • .github/workflows/bot-autoassign-stale-pr.yml
  • README.rst

Reviewed by kimi-k2.5 · 116,806 tokens

@nemesifier nemesifier force-pushed the fix-deprecated-uuid-admin branch from c821d9f to 869c109 Compare May 15, 2026 22:01
@nemesifier nemesifier force-pushed the fix-deprecated-uuid-admin branch from 869c109 to 95cdf80 Compare May 15, 2026 22:12
@openwisp-companion

Copy link
Copy Markdown

Code Style Failures Detected

Hello @nemesifier,
(Analysis for commit 869c109)

The CI build failed due to code style issues in openwisp_network_topology/admin.py.

Fix:
Please run the command openwisp-qa-format in your local environment to automatically format the code and resolve these issues.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage is 98.873%fix-deprecated-uuid-admin into master. No base build found for master.

@nemesifier nemesifier merged commit 95cdf80 into master May 15, 2026
17 checks passed
@nemesifier nemesifier deleted the fix-deprecated-uuid-admin branch May 15, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants