[Django] #33481: remove_stale_contenttypes causes data loss

39 views
Skip to first unread message

Django

unread,
Feb 1, 2022, 7:41:05 AM2/1/22
to django-...@googlegroups.com
#33481: remove_stale_contenttypes causes data loss
-------------------------------------------+------------------------
Reporter: Johannes Maron | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: dev
Severity: Release blocker | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
I just wanted to remove stale contenttypes from a system and noticed a
pretty significant bug.

The command prints a message before you need to confirm the deletion that
reads:
> This list doesn't include any cascade deletions to data outside of
Django's models (uncommon).

However, a quick investigation on the objects that are to be deleted
includes objects outside of Django's scope.
In my case:

> - 2 auth.Group_permissions object(s)
> - 7185 joeflow.Task object(s)
> - 5519 joeflow.Task_parent_task_set object(s)

This misinformation can cause users to delete data without double-
checking.

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

Django

unread,
Feb 1, 2022, 12:19:57 PM2/1/22
to django-...@googlegroups.com
#33481: remove_stale_contenttypes causes data loss
---------------------------------+--------------------------------------

Reporter: Johannes Maron | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: dev
Severity: Release blocker | Resolution:

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

Comment (by Tim Graham):

I think you've misunderstood the message. The data you listed seem to be
Django objects and relations. Why do you say they are "outside of Django's
scope"? Aren't they printed as part of the deletion warning?

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

Django

unread,
Feb 1, 2022, 12:51:30 PM2/1/22
to django-...@googlegroups.com
#33481: remove_stale_contenttypes causes data loss
-------------------------------------+-------------------------------------

Reporter: Johannes Maron | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: dev
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 Johannes Maron):

* type: Bug => Cleanup/optimization
* component: Uncategorized => Documentation
* severity: Release blocker => Normal


Comment:

Oooooh, now I get it. Wow, OK, is it just me, or is that sentence
misleading? Maybe we replace that sentence something that doesn't include
brackets at the end and not the term "Django's models"? Something a long
the lines of:

> The list above does not include deletions that may be caused by manually
added database constraints or triggers.

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

Django

unread,
Feb 1, 2022, 8:28:09 PM2/1/22
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
--------------------------------------+------------------------------------

Reporter: Johannes Maron | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.contenttypes | Version: dev
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 Tim Graham):

* component: Documentation => contrib.contenttypes
* stage: Unreviewed => Accepted


Comment:

I wrote the original sentence in e2dfa81ff7489d97700604d634adacf1384af184.
I guess you may have interpreted "Django's models" to mean `contrib.auth`?
I don't have an objection to some rewording but for me, it's more
intuitive to talk about "cascade deletions" and "relations" rather than
"constraints or triggers." Feel free to submit a PR to continue the
discussion with a merger.

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

Django

unread,
Jan 3, 2024, 7:37:33 AM1/3/24
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: Syed
Type: | Waheed
Cleanup/optimization | Status: assigned
Component: | Version: dev
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 Syed Waheed):

* owner: nobody => Syed Waheed
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33481#comment:4>

Django

unread,
Jan 6, 2024, 1:12:02 AM1/6/24
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: Syed
Type: | Waheed
Cleanup/optimization | Status: assigned
Component: | Version: dev
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
-------------------------------------+-------------------------------------

Comment (by Syed Waheed):

i have made the changes in the warning

--
Ticket URL: <https://code.djangoproject.com/ticket/33481#comment:5>

Django

unread,
Jan 7, 2024, 2:16:19 AM1/7/24
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: Syed
Type: | Waheed
Cleanup/optimization | Status: assigned
Component: | Version: dev
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
-------------------------------------+-------------------------------------

Comment (by Syed Waheed):

link to my fork - https://github.com/Waheedsys/django
link to my commit -
https://github.com/django/django/compare/main...Waheedsys:django:main
I would like to have a review of the changes

--
Ticket URL: <https://code.djangoproject.com/ticket/33481#comment:6>

Django

unread,
Jan 7, 2024, 2:19:29 AM1/7/24
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: Syed
Type: | Waheed
Cleanup/optimization | Status: assigned
Component: | Version: dev
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
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:6 Syed Waheed]:


> link to my fork - https://github.com/Waheedsys/django
> link to my commit -
https://github.com/django/django/compare/main...Waheedsys:django:main
> I would like to have a review of the changes

Please send a patch via GitHub PR (check out
[https://docs.djangoproject.com/en/5.0/internals/contributing/writing-code
/working-with-git/#publishing-work docs] for more details).

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

Django

unread,
Jan 8, 2024, 8:57:22 AM1/8/24
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: Syed
Type: | Waheed
Cleanup/optimization | Status: assigned
Component: | Version: dev
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
-------------------------------------+-------------------------------------

Comment (by Syed Waheed):

PR - https://github.com/django/django/pull/17707

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

Django

unread,
Jan 8, 2024, 11:10:40 AM1/8/24
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: Syed
Type: | Waheed
Cleanup/optimization | Status: assigned
Component: | Version: dev
contrib.contenttypes |
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 Mariusz Felisiak):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33481#comment:9>

Django

unread,
Jan 8, 2024, 2:08:28 PM1/8/24
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: Syed
Type: | Waheed
Cleanup/optimization | Status: assigned
Component: | Version: dev
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 Mariusz Felisiak):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/33481#comment:10>

Django

unread,
Jan 8, 2024, 3:39:14 PM1/8/24
to django-...@googlegroups.com
#33481: Clarify remove_stale_contenttypes data loss warning
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: Syed
Type: | Waheed
Cleanup/optimization | Status: closed
Component: | Version: dev
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 Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"415982be105380af5116692a2f6e91c8092803fb" 415982b]:
{{{
#!CommitTicketReference repository=""
revision="415982be105380af5116692a2f6e91c8092803fb"
Fixed #33481 -- Clarified remove_stale_contenttypes data loss warning.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33481#comment:11>

Reply all
Reply to author
Forward
0 new messages