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
--
Ticket URL: <https://code.djangoproject.com/ticket/26936>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => bmispelon
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:2>
* owner: bmispelon =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:3>
* status: new => assigned
* owner: nobody => Pavel
Comment:
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
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:3>
Comment (by Tim Graham):
No, all pull requests should go to master. The committer will determine if
it needs to be backported per our
[https://docs.djangoproject.com/en/dev/internals/release-process
/#supported-versions supported versions policy]. I don't think it would in
this case.
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:4>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
The [https://github.com/django/django/pull/8022 PR] has some test
isolation issues.
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:5>
* needs_better_patch: 1 => 0
Comment:
Fixed the isolation issues in [https://github.com/django/django/pull/8022
PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:6>
Comment (by Pavel):
Updated the pull request according to code review remarks
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:7>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"874b1f2cac7b79597ce87cc244b7cefc5c5cd821" 874b1f2]:
{{{
#!CommitTicketReference repository=""
revision="874b1f2cac7b79597ce87cc244b7cefc5c5cd821"
Fixed #26936 -- Fixed stale ContentType deletion in apps without models.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:9>