Opened 6 years ago

Closed 6 years ago

#11428 closed (fixed)

manage.py reset not working for proxy models

Reported by: akaariai 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: UI/UX:

Description (last modified by ramiro)

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

class Test(models.Model):
    pass

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

Running python manage.py sqlreset testapp I get the following output:

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

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

Attachments (1)

patch.diff (3.3 KB) - added by akaariai 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 6 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.0 to SVN

comment:2 Changed 6 years ago by ramiro

  • Description modified (diff)

(reformatted description)

Changed 6 years ago by akaariai

comment:3 Changed 6 years ago by akaariai

  • 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 manage.py 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 6 years ago by russellm

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

(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