Repository navigation
Conversation
validate_user queried the user model directly, so when the user table did not exist yet (e.g. running migrate on a fresh database) the system check crashed with a raw OperationalError/ProgrammingError instead of reporting a warning. Catch those database errors and raise a ValidationError so the check reports flags.E002 and migrations can proceed.
This package includes two Django checks that are generated at level Warning, but are currently named like E001 and E002, implying Error. The Django docs at https://docs.djangoproject.com/en/6.1/ref/checks/ say: > Identifiers should follow the pattern applabel.X001, where X is one > of the letters CEWID, indicating the message severity (C for > criticals, E for errors and so). This commit renames those checks to properly reflect their severity as warnings, not errors.
This was referenced Oct 29, 2026
wpears
approved these changes
Oct 29, 2026
wpears
left a comment
Member
There was a problem hiding this comment.
Seems like a reasonable approach to me
This branch has not been deployed
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.
Django migrations currently fail with an unhandled exception if a user condition is defined; this is because the user condition validation queries the database, but the flags table will not have been created yet. The conditions are validated as part of this package's Django system checks.
As a fix, this PR modifies the condition so that it treats a missing user table as a failed validation. This will generate a warning, but not break in an unhandled way. Running migrations against an empty database will still show a warning:
As part of this change, this package's checks have been renamed from
flags.E001andflags.E002toflags.W001andflags.W002, to be consistent with Django's guidance on check naming:Because these checks are generated as warnings, not errors, they should start with
W.This PR also includes unrelated ruff fixes to address formatting issues in Markdown code snippets.
Fixes #96. Thanks to @olitreadwell for this contribution. FYI @willbarton, we miss you.