This commit is contained in:
Yyonging 2020-06-27 21:10:09 +08:00 committed by GitHub
parent 4647b17c3c
commit b004c8af19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
import abc
import datetime
import weakref
__all__ = ('BaseField', 'Field', 'ListField', 'DateTimeField', 'TextField', 'ListOfLists')
@ -109,7 +110,9 @@ class Field(BaseField):
and self.base_object is not None \
and not hasattr(value, 'base_object') \
and not hasattr(value, 'to_python'):
return self.base_object(conf={'parent': parent}, **value)
if not isinstance(parent, weakref.ReferenceType):
parent = weakref.ref(parent)
return self.base_object(conf={'parent':parent}, **value)
return value