Changes between Version 3 and Version 8 of Ticket #27311


Ignore:
Timestamp:
Oct 5, 2016, 2:25:58 PM (8 years ago)
Author:
Markus Holtermann
Comment:

This is not really feasible as the unpickling of models from cache uses the global app registry (https://github.com/django/django/blob/d5c0eb7d686ea89d6dbf787abc5bf18302c4e428/django/db/models/base.py#L1770). We would need to look up the models from the app registry at this state of the migration process. I have no idea how we could achieve that w/o passing apps around all the time.

I also think it's not a good idea to cache objects during the migration process. You can easily end up with objects from previous model states that are completely invalid at a later stage because too many things changed in between that wasn't taken care of for cached model instances.

I'm closing this as won't fix for the time being. If this is possible at some point we could re-evaluate the feature, but for now I doubt it's going to work out.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27311

    • Property Cc Markus Holtermann added
    • Property Keywords cache added
    • Property Resolutionwontfix
    • Property Triage Stage UnreviewedSomeday/Maybe
    • Property Status newclosed
    • Property Summary Assigning ForeignKey fields in migrationsSupport unpickled models (e.g. read from cache) in migrations
    • Property Type BugNew feature
    • Property Version 1.10master
  • Ticket #27311 – Description

    v3 v8  
    3030Cannot assign "<User: Some User>": "B.client" must be a "User" instance.
    3131}}}
     32
     33Investigating the issue shows that it's due to the models being read from cache.
Back to Top