django-reversion to store history of certain models. Some of these versioned models have "one to many" or "many to many" relations between them.
django-reversion is properly configured to "follow" relations, so that all models are stored in the same revision.
I don't need to saved restore versions, I just need to be able to deserialize the models stored in a given revision and call a method on one of the deserialized models (for instance
deserialized_model.object.get_summary()). Problem is that the method accesses related objects, and the related objects being used are the objects currently in database, and not the deserialized objects. I am deserializing all models I need at the same time.
Is there any way to make deserialized model instances use deserialized related model instances instead of actual instances? Note that this is not a
django-reversion issue, it's more on the Django side.
I tried deceiving Django with
prefetch_related. The idea was to store the deserialized objects as prefetched results, so that the related managers would retrieve objects from there and not from the database. Still no luck.
There is an issue tracker for
I would start there as the project owner may not be monitoring SO. You may also get answers from the ~90 contributors or ~60 watchers there.
As of now, the most complete answer to the question is: It is not possible to make deserialized model instances use other deserialized model instances as related objects.