Skip to content

Fix database router type hints#3074

Merged
sobolevn merged 1 commit into
typeddjango:masterfrom
emmanuel-ferdman:fix-router-allow-relation
Feb 13, 2026
Merged

Fix database router type hints#3074
sobolevn merged 1 commit into
typeddjango:masterfrom
emmanuel-ferdman:fix-router-allow-relation

Conversation

@emmanuel-ferdman

Copy link
Copy Markdown
Contributor

PR Summary

allow_relation was incorrectly typed to take type[Model] (model classes) but Django actually passes model instances. The fix aligns with how Django calls this method and matches the existing stubs in django-stubs/db/utils.pyi.

Fixes #3071.

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
@sobolevn sobolevn merged commit 49544a2 into typeddjango:master Feb 13, 2026
54 checks passed
@emmanuel-ferdman emmanuel-ferdman deleted the fix-router-allow-relation branch February 14, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

TypedDatabaseRouter.allow_relation has incorrect type hints - uses type[Model] instead of Model

2 participants