Opened 6 years ago

Closed 6 years ago

#29751 closed Bug (duplicate)

Saving deserialized objects in custom migration fails in certain cases

Reported by: Kedar Owned by: Kedar
Component: Migrations Version: 1.11
Severity: Normal Keywords: serialize, deserialize, migration
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Saving deserialised objects in custom migration fails in certain cases (model has new fields added since) because _get_model used here uses the latest version of the model (rather than the migration-specific model, which is derived using apps.get_model where apps is the first argument passed to a custom migration function - which is passed to migrations.RunPython)

Fix here would be to pass the apps received as first argument in a custom migration via the **options in deserialize()

Change History (3)

comment:1 by Kedar, 6 years ago

Owner: changed from nobody to Kedar
Status: newassigned

comment:2 by Carlton Gibson, 6 years ago

Component: Database layer (models, ORM)Migrations
Easy pickings: unset

At first glance this seems plausible.

@0xKD: you've assigned yourself. Can you add a failing test case that reproduces the issue here?

comment:3 by Tim Graham, 6 years ago

Resolution: duplicate
Status: assignedclosed

I'd call this is a duplicate of #24778.

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