简体   繁体   中英

django-picklefield not deserializing custon class object

I have a model defined with a field using django-picklefield. Everything was working fine till I refactored our codebase for organizational reasons, but now when I load that model from the db I get back a unicode object instead of the unpickled object. Because the class definition moved pickle cannot find the module it needs to import, I traced the error back to here where pickle tries to import a module that no longer exists.

Is there a way I can resolve this import error by pointing pickle to the correct module or somehow fake the existence of that class definition in the module pickle is looking in with other imports or by creating a class of the same name that inherits from the original class that lives elsewhere?

我可以通过重新创建已删除的旧文件来解决此问题,并且该文件只包含一行导入pickle正在寻找的类。

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