diff --git a/deform/field.py b/deform/field.py index 1f56ab03..1d584ede 100644 --- a/deform/field.py +++ b/deform/field.py @@ -187,6 +187,11 @@ def __init__( ): self.counter = counter or itertools.count() self.order = next(self.counter) + if parent is not None: + parent = weakref.ref(parent) + self._parent = parent + oid_prefix = getattr(self.get_root(), "formid", "deform") + self.oid = getattr(schema, "oid", f"{oid_prefix}Field{self.order}") self.schema = schema self.typ = schema.typ # required by Invalid exception self.name = schema.name @@ -221,11 +226,6 @@ def __init__( self.resource_registry = resource_registry self.children = [] - if parent is not None: - parent = weakref.ref(parent) - self._parent = parent - oid_prefix = getattr(self.get_root(), "formid", "deform") - self.oid = getattr(schema, "oid", f"{oid_prefix}Field{self.order}") self.__dict__.update(kw) first_input_index = -1