'swapped' checking does not account for case insensitivity
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.5-beta-1|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
According to the code at django/db/models/options.py:230 the test for "has this class been swapped?" is essentially: "if there's a swapped meta option, and the option is not None, and the option isn't simply the name of the current model, in "appname.model" format"
However, the test doesn't take into account that the model part of appname.model is case insensitive.
While we could simply normalise app_name and that coming back from the setting, I think a better test would be:
"if there's a swapped meta option, and the option is not none, and the "get_model()" using that option is not the same as the current class instance." Ie, rather than assume model names are case insensitive, just use the get_model and ensure it doesn't return us.
Change History (19)
comment:2 Changed 4 years ago by
|Status:||closed → reopened|
comment:6 Changed 4 years ago by
|Severity:||Normal → Release blocker|
|Triage Stage:||Unreviewed → Accepted|