Opened 4 years ago

Closed 11 months 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: apollo13 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

Description

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 apollo13 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 4 years ago by apollo13

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Ups, diff got lost, but it's in this paste: http://paste.pocoo.org/show/356446/

Changed 4 years ago by apollo13

comment:2 Changed 4 years ago by lukeplant

  • Type set to Bug

comment:3 Changed 4 years ago by lukeplant

  • Severity set to Normal

comment:4 Changed 4 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

comment:5 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:6 Changed 3 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:7 Changed 11 months ago by aaugustin

  • Resolution set to wontfix
  • Status changed from new to closed

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