Opened 6 years ago

Closed 2 years ago

#15654 closed Bug (wontfix)

qs.delete() fails if a model isn't in INSTALED_APPS and the related objects cache is already filled.

Reported by: Florian Apolloner Owned by: nobody
Component: Database layer (models, ORM) Version: master
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


ContentType.objects.delete() fails for use since 1.3 (on_delete support to be exact) since it tries to delete all related objects pointing to that contenttype. If one of the related models is not in INSTALLED_APPS (in our case django.contrib.auth), this can fail if the model got imported (which registers it etc…; in our case django.contrib.contenttypes.generic imported auth.models -- via contrib.admin). Attached is a testcase showcasing the issue.

Attachments (1)

test.diff (1.7 KB) - added by Florian Apolloner 6 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by Florian Apolloner

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Ups, diff got lost, but it's in this paste:

Changed 6 years ago by Florian Apolloner

Attachment: test.diff added

comment:2 Changed 6 years ago by Luke Plant

Type: Bug

comment:3 Changed 6 years ago by Luke Plant

Severity: Normal

comment:4 Changed 6 years ago by Jacob

Triage Stage: UnreviewedAccepted

comment:5 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 Changed 2 years ago by Aymeric Augustin

Resolution: wontfix
Status: newclosed

After the app loading refactor, you aren't allowed to import models that aren't in an installed application.

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