

def get_version_object(self, version):
    obj_version = version.object_version
    obj = obj_version.object
    obj._state.db = self.obj._state.db
    for (field_name, pks) in obj_version.m2m_data.items():
        f = self.opts.get_field(field_name)
        if (f.rel and isinstance(f.rel, models.ManyToManyRel)):
            setattr(obj, f.name, f.rel.to._default_manager.get_query_set().filter(pk__in=pks).all())
    detail = self.get_model_view(DetailAdminUtil, self.model, obj)
    return (obj, detail)

dataset/ETHPy150Open sshwsfc/xadmin/xadmin/plugins/xversion.py RevisionListView.get_version_object/original