Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12999 closed (fixed)

update_all_contenttypes in fails in django 1.2

Reported by: lsbardel Owned by: nobody
Component: Contrib apps Version: master
Severity: Keywords: contenttypes
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


Bug introduced with multiple database support. The function loop over installed applications and call update_contenttypes without passing a keyworded "db" argument.
update_contenttypes fails when no "db" is available. To fix the problem I replaced

db = kwargs["db"]


db = kwargs.get('db',None)

Attachments (2)

management.diff (545 bytes) - added by lsbardel 7 years ago.
management_no_using.diff (1.5 KB) - added by lsbardel 7 years ago.

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by lsbardel

Attachment: management.diff added

comment:1 Changed 7 years ago by lsbardel

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

comment:2 Changed 7 years ago by Russell Keith-Magee

milestone: 1.2
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

To be clear, the issue is specifically with the update_all_contenttypes() call. This highlights that there are a couple of problems with the current implementation; there shouldn't be the need for calls to using in update_contenttypes().

Changed 7 years ago by lsbardel

Attachment: management_no_using.diff added

comment:3 Changed 7 years ago by lsbardel

Removed "using" in update_contenttypes. This way ContentType objects will be saved in the default database or the one specified in the routing scheme.

comment:4 Changed 7 years ago by Gabriel Hurley

Component: UncategorizedContrib apps

comment:5 Changed 7 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [12750]) Fixed #12999 -- Modified the contenttypes syncdb handler to use db router logic. Thanks to lsbardel for the report.

comment:6 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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