Opened 7 years ago

Closed 7 years ago

#28417 closed Bug (wontfix)

django.db.migrations.DeleteModel doesn't delete corresponding permissions

Reported by: nikokio Owned by: nobody
Component: contrib.auth Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

When deleting a model with django.db.migrations.DeleteModel, I notice permissions for this model still exist in table AUTH_PERMISSION and are still available in the Django GUI.

They should be logically deleted with the model.

Regards
Nicolas

Change History (1)

comment:1 by Tim Graham, 7 years ago

Component: Migrationscontrib.auth
Resolution: wontfix
Status: newclosed
Summary: django.db.migrations.DeleteModel doesn't cascade permissionsdjango.db.migrations.DeleteModel doesn't delete corresponding permissions

In contrib.contenttypes, stale ContentTypes must be deleted with the remove_stale_contenttypes management command. They aren't removed automatically to prevent unexpected cascading data loss. Since Permission has a foreign key to ContentType, stale permissions are deleted when removing stale content types. I think it's safer to keep the current workflow rather than automatically removing data. You can write to the DevelopersMailingList if you disagree with this reasoning.

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