Add TODOs for upgrading to Django 6 - #1579
Conversation
📝 WalkthroughWalkthroughAdded Django 6 migration TODO comments to accession creation, extraction, constraint validation, and related tests. Runtime behavior remains unchanged. ChangesDjango 6 migration TODOs
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
isic/ingest/models/accession.py (1)
362-366: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winMake the migration TODO explicit about the validation it restores.
validate_constraints=FalseskipsModel.validate_constraints(), which validates every constraint inMeta.constraints, not only these twoExclusionConstraints. Update the TODO to remove this flag from all affected accession call sites after the Django 6 upgrade, and add a regression test for the constraints. Django 6.0 documents this parameter behavior, and PR#19535fixes the ForeignKeyattnamefailure. (docs.djangoproject.com)Proposed comment update
- # TODO(django 6): these two conditions reference foreign keys by attname, which - # django can't resolve during python-side constraint validation. that makes - # full_clean(validate_constraints=True) raise FieldError on every accession, so - # callers pass validate_constraints=False. fixed by - # https://github.com/django/django/pull/19535, released in django 6. + # TODO(django 6): remove validate_constraints=False from all accession + # full_clean() call sites after upgrading. Django 5.2 raises FieldError + # while validating these two ExclusionConstraints because they use + # foreign-key attnames. The flag also skips validation of every + # Meta.constraints entry. Fixed by + # https://github.com/django/django/pull/19535.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@isic/ingest/models/accession.py` around lines 362 - 366, Update the TODO near the accession foreign-key constraint conditions to explicitly state that, after upgrading to Django 6, all affected accession call sites must remove validate_constraints=False so Model.validate_constraints() runs for every Meta.constraints entry, and add a regression test covering the constraints.Source: MCP tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@isic/ingest/models/accession.py`:
- Around line 362-366: Update the TODO near the accession foreign-key constraint
conditions to explicitly state that, after upgrading to Django 6, all affected
accession call sites must remove validate_constraints=False so
Model.validate_constraints() runs for every Meta.constraints entry, and add a
regression test covering the constraints.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 79ef8771-f0a3-4e53-81b6-f870baa31098
📒 Files selected for processing (5)
isic/core/management/commands/add_sample_data.pyisic/ingest/models/accession.pyisic/ingest/models/zip_upload.pyisic/ingest/services/accession/__init__.pyisic/ingest/tests/test_accession.py
Summary by CodeRabbit