Skip to content

Add Role model and admin editing - #908

Draft
AdrianDAlessandro wants to merge 6 commits into
mainfrom
880-curate-roles
Draft

AdrianDAlessandro wants to merge 6 commits into
mainfrom
880-curate-roles

Conversation

@AdrianDAlessandro

Copy link
Copy Markdown
Collaborator

Description

Note: Marking this PR as draft because I want to hold off from merging it until after the next release (with the Teams feature fully implemented) is made.

This PR adds a model for the Roles and the ability to manage them from the admin backend. That required:

  • Adding the Role model to framework_models.py
  • Making the migrations
  • Adding to admin (including a warning for when optional fields are empty)
  • Adding an IOResources class for admin Import/Export
  • Adding a validation helper function to check that the secondary_domains do not include the primary_domain.
  • Apply that validation to:
    • Admin (requires custom admin form)
    • IO Resource
    • m2m_changed signal to prevent saving invalid values in other ways.
    • (Note that this is not checked in the model.clean because the m2m relations are not known at that point)

There are additionally a set of get_deleted_objects methods to add some more information about related objects that will be deleted to the "confirm delete" pages in the admin.

Fixes #880

Type of change

  • Documentation (non-breaking change that adds or improves the documentation)
  • New feature (non-breaking change which adds functionality)
  • Optimization (non-breaking, back-end change that speeds up the code)
  • Technical work (non-breaking, change which is work as part of a new feature)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (whatever its nature)

Key checklist

  • All tests pass (eg. python -m pytest)
  • The documentation builds and looks OK (eg. mkdocs serve)
  • Pre-commit hooks run successfully (eg. pre-commit run --all-files)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

AdrianDAlessandro and others added 6 commits December 1, 2026 13:52
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Validate submitted secondary domains rather than stale relations during admin edits.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.27027% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
main/admin.py 50.76% 32 Missing ⚠️
main/signals.py 92.85% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Curate Roles in Django admin

1 participant