[Django] #26936: Stale content type deletion stops working if all models in an app are deleted

9 views
Skip to first unread message

Django

unread,
Jul 22, 2016, 4:46:38 PM7/22/16
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
------------------------------------------------+------------------------
Reporter: bmispelon | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/26936>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 22, 2016, 4:46:54 PM7/22/16
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: bmispelon
Type: Bug | Status: assigned
Component: | Version: 1.9
contrib.contenttypes |
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bmispelon):

* owner: nobody => bmispelon
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:1>

Django

unread,
Jul 22, 2016, 4:51:48 PM7/22/16
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: bmispelon
Type: Bug | Status: assigned
Component: | Version: 1.9
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:2>

Django

unread,
Jul 22, 2016, 5:23:27 PM7/22/16
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
--------------------------------------+------------------------------------
Reporter: bmispelon | Owner:

Type: Bug | Status: new
Component: contrib.contenttypes | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by bmispelon):

* owner: bmispelon =>
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:3>

Django

unread,
Feb 1, 2017, 5:11:15 PM2/1/17
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
--------------------------------------+------------------------------------
Reporter: Baptiste Mispelon | Owner: Pavel
Type: Bug | Status: assigned
Component: contrib.contenttypes | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Pavel):

* 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

Django

unread,
Feb 1, 2017, 5:20:03 PM2/1/17
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
--------------------------------------+------------------------------------
Reporter: Baptiste Mispelon | Owner: Pavel
Type: Bug | Status: assigned
Component: contrib.contenttypes | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

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>

Django

unread,
Feb 6, 2017, 8:52:21 AM2/6/17
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
--------------------------------------+------------------------------------
Reporter: Baptiste Mispelon | Owner: Pavel
Type: Bug | Status: assigned
Component: contrib.contenttypes | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* 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>

Django

unread,
Feb 6, 2017, 4:37:29 PM2/6/17
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
--------------------------------------+------------------------------------
Reporter: Baptiste Mispelon | Owner: Pavel
Type: Bug | Status: assigned
Component: contrib.contenttypes | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Pavel):

* 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>

Django

unread,
Feb 9, 2017, 5:35:22 AM2/9/17
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
--------------------------------------+------------------------------------
Reporter: Baptiste Mispelon | Owner: Pavel
Type: Bug | Status: assigned
Component: contrib.contenttypes | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Pavel):

Updated the pull request according to code review remarks

--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:7>

Django

unread,
Jun 14, 2017, 2:57:23 PM6/14/17
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
-------------------------------------+-------------------------------------

Reporter: Baptiste Mispelon | Owner: Pavel
Type: Bug | Status: assigned
Component: | Version: 1.9
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26936#comment:8>

Django

unread,
Jun 16, 2017, 10:08:41 AM6/16/17
to django-...@googlegroups.com
#26936: Stale content type deletion stops working if all models in an app are
deleted
-------------------------------------+-------------------------------------
Reporter: Baptiste Mispelon | Owner: Pavel
Type: Bug | Status: closed
Component: | Version: 1.9
contrib.contenttypes |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages