Fix #1275: is_reviewed flag inconsistencies and media access control #1280
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.
Fixes #1275
Note: I am not a Python programmer and this fix was developed with heavy assistance from AI tools. While the solution has been carefully analyzed, it has not been tested! So I recommend thorough code review by experienced Python/Django developers before merging.
Problem
The
is_reviewed
flag exhibited inconsistent behavior:is_reviewed
as true when database value was falseis_reviewed = false
remained publicly accessible despite review settingsRoot Cause Analysis
is_reviewed
field was completely removed from forms for non-editors usingself.fields.pop("is_reviewed")
, causing frontend display inconsistenciesis_reviewed
via API, thelistable
field wasn't included inupdate_fields
, so the recalculated value wasn't persisted to the databaseSolution
is_reviewed
field readonly/disabled for non-editors instead of removing it entirelylistable
inupdate_fields
when updatingis_reviewed
to ensure the recalculated value is savedTechnical Details
listable
field is recalculated in the model'ssave()
method based onstate
,encoding_status
, andis_reviewed
update_fields=["is_reviewed"]
only persists theis_reviewed
change, ignoring the recalculatedlistable
valueis_reviewed=False
butlistable=True
, allowing unintended public accessTesting
Request for Review
Given my limited Python/Django experience, I especially welcome feedback on:
update_fields
parameter