Refine Site model fields and reorder SiteManager#3134
Open
ahmedasar00 wants to merge 1 commit intotypeddjango:masterfrom
Open
Refine Site model fields and reorder SiteManager#3134ahmedasar00 wants to merge 1 commit intotypeddjango:masterfrom
ahmedasar00 wants to merge 1 commit intotypeddjango:masterfrom
Conversation
0bd3a7c to
7ac2ef8
Compare
sobolevn
reviewed
Mar 1, 2026
|
|
||
| domain = models.CharField(max_length=100) | ||
| name = models.CharField(max_length=50) | ||
| domain: Any |
Member
There was a problem hiding this comment.
Sorry, why do we change a model field to be Any? What is the original error?
Contributor
Author
There was a problem hiding this comment.
Sorry, why do we change a model field to be
Any? What is the original error?
I used Any while debugging a stubtest error, but I agree the concrete types are better.
Should I revert them to str / int ?
Contributor
There was a problem hiding this comment.
I dont think we should change anything here, I'm pretty sure the current state is correctly infered by the mypy plugin
Contributor
Author
There was a problem hiding this comment.
In my opinion, I find it useful because it prevents forward references and using str and int helps ensure greater accuracy, although I could be wrong.
aaa3b95 to
f6304a8
Compare
Detailed changes: - Map Site fields (id, domain, name) to concrete types to fix DeferredAttribute errors. - Type SITE_CACHE as dict[int | str, Site] for better precision. - Add missing __str__ method to Site stub. - Remove resolved Site entries from stubtest allowlist.
2502296 to
f29c3fa
Compare
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.
Changes
Anytype hints and replaced them with concrete types:django.contrib.sites.models.Site.domain→strdjango.contrib.sites.models.Site.name→strdjango.contrib.sites.models.Site.id→intSiteManagermethods typing for better accuracy.Notes
SiteManagerdefinition after theSiteclass to avoid potential forward reference issues.