简体   繁体   中英

How to undo serialize list on Django

I serialized a list of Django models like this:

serialize_list = serializers.serialize("json", my_list)

and now I want to deserialize it and get back a list of Django models. Instead, when I do deserialize_list = serializers.deserialize("json", serialize_list )

I get a list of DeserializedObject models and not the original list.

My question is: how can I get the original list back?

反序列化列表的每个元素都有一个object属性,其中包含模型实例。

original = [item.object for item in deserialize_list]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM