Opened 16 months ago

Last modified 16 months ago

#33481 new Cleanup/optimization

Clarify remove_stale_contenttypes data loss warning

Reported by: Johannes Maron Owned by: nobody
Component: contrib.contenttypes Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


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.

Change History (3)

comment:1 Changed 16 months ago 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?

comment:2 Changed 16 months ago by Johannes Maron

Component: UncategorizedDocumentation
Severity: Release blockerNormal
Type: BugCleanup/optimization

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.

comment:3 Changed 16 months ago by Tim Graham

Component: Documentationcontrib.contenttypes
Summary: remove_stale_contenttypes causes data lossClarify remove_stale_contenttypes data loss warning
Triage Stage: UnreviewedAccepted

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.

Note: See TracTickets for help on using tickets.
Back to Top