-
-
Notifications
You must be signed in to change notification settings - Fork 87
[change] Refactor ReceiveUrlAdmin to inherit CopyableFieldAdmin #344 #550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[change] Refactor ReceiveUrlAdmin to inherit CopyableFieldAdmin #344 #550
Conversation
e6c43e2 to
edd8283
Compare
…isp#344 - Refactored ReceiveUrlAdmin to inherit from CopyableFieldsAdmin instead of ModelAdmin - Eliminated code duplication in add_view/change_view methods - Made receive_url work as a copyable field automatically - Updated ProjectAdmin to use single inheritance (no longer needs UUIDAdmin + ReceiveUrlAdmin) - Updated tests to reflect correct behavior (copyable fields excluded from add forms) - Reduced JavaScript and Python logic repetition This addresses the enhancement request to reduce repetition between ReceiveUrlAdmin and CopyableFieldAdmin by using proper inheritance. Fixes openwisp#344
edd8283 to
559f85e
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughReceiveUrlAdmin is refactored to inherit from CopyableFieldsAdmin instead of ModelAdmin, enabling the receive_url field to be marked as copyable. The ProjectAdmin test class is updated to inherit only from ReceiveUrlAdmin and explicitly configures copyable_fields for both "uuid" and "receive_url", with a custom uuid method implementation. Test assertions are updated to reflect the modified field ordering where receive_url now appears as a copyable field at the end of the admin form. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code graph analysis (2)tests/test_project/tests/test_admin.py (1)
tests/test_project/admin.py (1)
🪛 Ruff (0.14.11)tests/test_project/admin.py83-83: Mutable class attributes should be annotated with (RUF012) 🔇 Additional comments (4)
✏️ Tip: You can disable this entire section by setting 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. Comment |
Checklist
Refactored ReceiveUrlAdmin to inherit from CopyableFieldsAdmin instead of ModelAdmin
Eliminated code duplication in add_view/change_view methods
Made receive_url work as a copyable field automatically
Updated ProjectAdmin to use single inheritance (no longer needs UUIDAdmin + ReceiveUrlAdmin)
Updated tests to reflect correct behavior (copyable fields excluded from add forms
Fixes #344