Opened 10 years ago

Closed 9 years ago

#11428 closed (fixed) reset not working for proxy models

Reported by: Anssi Kääriäinen Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

I have created a new project and a new app, testapp. In testapp/ I have:

class Test(models.Model):

class Test2(Test):
    class Meta:
        proxy = True

Running python sqlreset testapp I get the following output:

DROP TABLE "testapp_test";
DROP TABLE "testapp_test";
CREATE TABLE "testapp_test" (
    "id" integer NOT NULL PRIMARY KEY
CREATE TABLE "testapp_test" (

I am using Django version 1.1 beta 1 SVN-11196.

Attachments (1)

patch.diff (3.3 KB) - added by Anssi Kääriäinen 10 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 10 years ago by anonymous

Version: 1.0SVN

comment:2 Changed 10 years ago by Ramiro Morales

Description: modified (diff)

(reformatted description)

Changed 10 years ago by Anssi Kääriäinen

Attachment: patch.diff added

comment:3 Changed 10 years ago by Anssi Kääriäinen

Has patch: set
Patch needs improvement: set

The problem is that proxy models are handled as if they were real models in (all?) of the commands. I have attached a patch just to show where the problem is.

Maybe the correct way would be to implement a get_models_noproxy() method in django.db.models?

comment:4 Changed 9 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [11343]) Fixed #11428 -- Ensured that SQL generating commands and dumpdata don't include proxy models in their output. Thanks to Anssi Kaariainen for the report.

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