#29751: Saving deserialized objects in custom migration fails in certain cases
-------------------------------------+-------------------------------------
Reporter: 0xKD | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) | Keywords:
Severity: Normal | serialize,deserialize,migration
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
Saving deserialised objects in custom migration fails in certain cases
(model has new fields added since) because `_get_model` used
[[https://github.com/django/django/blob/b9cf764be62e77b4777b3a75ec256f6209a57671/django/core/serializers/python.py#L91|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()`
--
Ticket URL: <https://code.djangoproject.com/ticket/29751>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/047.99b5dbf7895f9ec15e94136b7815714e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.