Migrate contest, problem authors/curators/testers to Role#564
Open
whlongg wants to merge 2 commits intoVNOI-Admin:masterfrom
Open
Migrate contest, problem authors/curators/testers to Role#564whlongg wants to merge 2 commits intoVNOI-Admin:masterfrom
whlongg wants to merge 2 commits intoVNOI-Admin:masterfrom
Conversation
955a995 to
d4d6086
Compare
11 tasks
d4d6086 to
a153e3f
Compare
a153e3f to
c56fcb7
Compare
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactor role management for
Contestby migrating the separateauthors,curators, andtestersM2M relationships to a unifiedContestRolemodel.Type of change: refactor
What
ContestRolemodelauthors,curators, andtestersvia query adapters, so most callers continue to work unchangedWhy
The existing role system stores
authors,curators, andtestersas separate M2M fields onContest, which duplicates the same concept in multiple places and makes permission logic harder to maintain. Consolidating these relationships into a dedicated role table gives us a single extensible structure while preserving current behavior.A follow-up PR will apply the same pattern to
Problem.Fixes #563 (partial — contest side)
How Has This Been Tested?
python manage.py migrate judgepython manage.py test judge.models.tests.test_contest judge.models.tests.test_role --keepdbpython manage.py test judge.views.tests.test_submission --keepdbflake8 judge/models/role.py judge/models/__init__.py judge/models/contest.py judge/admin/contest.py judge/views/contests.py judge/views/organization.py judge/views/submission.py judge/views/api/api_v2.py judge/jinja2/submission.py judge/models/tests/test_contest.py judge/models/tests/test_role.py judge/models/tests/util.py judge/migrations/0220_migrate_contest_roles.pyChecklist
Notes for reviewers
authors/curators/testersM2M fields onContestare removed, but compatibility is preserved at the model usage level via adapter propertiesProblemrole migration will follow in a separate PRBy submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.