Opened 8 years ago
Closed 7 years ago
#26936 closed Bug (fixed)
Stale content type deletion stops working if all models in an app are deleted
Reported by: | Baptiste Mispelon | Owned by: | Pavel |
---|---|---|---|
Component: | contrib.contenttypes | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Steps to reproduce:
1) Create an app with one model in its models.py
2) Add it to settings.INSTALLED_APPS
, run makemakigrations
, and migrate
3) Delete the model from models.py
, run makemigrations
, then migrate
At step 3), Django deletes the model from the database (as expected) but doesn't prompt the user to delete the now stale content type (as normally happens when you run migrate
).
I believe this is called by the if not app_config.models_module: return
statement in update_contenttypes()
[1]
[1] https://github.com/django/django/blob/master/django/contrib/contenttypes/management.py#L95-L96
Change History (8)
comment:2 by , 8 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 8 years ago
No, all pull requests should go to master. The committer will determine if it needs to be backported per our supported versions policy. I don't think it would in this case.
comment:5 by , 8 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
The PR has some test isolation issues.
comment:8 by , 7 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Hi,
This issue is reported on version 1.9 but it also reproduces on later versions. Should I make the fix on every release starting with 1.9?
Thanks