Fix Django 6.0 Autodetector mismatch errors with dynamic command inheritance#115
Closed
erdem wants to merge 2 commits intoxelixdev:mainfrom
Closed
Fix Django 6.0 Autodetector mismatch errors with dynamic command inheritance#115erdem wants to merge 2 commits intoxelixdev:mainfrom
erdem wants to merge 2 commits intoxelixdev:mainfrom
Conversation
mikicz
reviewed
Jan 5, 2026
Collaborator
mikicz
left a comment
There was a problem hiding this comment.
Ruff is suggesting these.
Otherwise looks ok!
Comment on lines
22
to
24
| cmd = load_command_class(app_config.name, "makemigrations") | ||
| # Found a custom makemigrations command, use it as base | ||
| return cmd |
Collaborator
There was a problem hiding this comment.
Suggested change
| cmd = load_command_class(app_config.name, "makemigrations") | |
| # Found a custom makemigrations command, use it as base | |
| return cmd | |
| return load_command_class(app_config.name, "makemigrations") |
Comment on lines
21
to
23
| cmd = load_command_class(app_config.name, "migrate") | ||
| # Found a custom migrate command, use it as base | ||
| return cmd |
Collaborator
There was a problem hiding this comment.
Suggested change
| cmd = load_command_class(app_config.name, "migrate") | |
| # Found a custom migrate command, use it as base | |
| return cmd | |
| return load_command_class(app_config.name, "migrate") |
Author
|
Pushed another patch to cover up ruff complains and I have updated the PR description as well. |
Author
|
Just realized another issue with this PR patch. Also, this branch was only supposed to be used for fork testing. Closing this PR for now. I'll create a new one after merging our main fork branch. |
Author
|
There is a better expiation why I have closed this PR in our fork repo PR description. |
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.
Problem
django-pgviews validates that both
makemigrationsandmigrateusePGViewsAutodetectorto properly detect view changes (seechecks.py). When packages like django-linear-migrations are listed before django-pgviews inINSTALLED_APPS, theirmakemigrationscommand loads first without PGViewsAutodetector, causing the validation to fail:Impact: Without PGViewsAutodetector on both commands, view removals and changes may not be detected properly in migrations.
Solution
Both commands now dynamically inherit from any custom command loaded by apps before django-pgviews:
This ensures both commands use PGViewsAutodetector while preserving functionality from other packages.
Changes