Start to uncouple form's and their fields
@@ -612,7 +612,7 @@ def __init__(self, **kwargs):
@property
def form(self):
- return self.iommi_parent().iommi_parent()
+ return self.iommi_parent().iommi_evaluate_parameters()['form']
# noinspection PyUnusedLocal
@staticmethod
@@ -665,7 +665,7 @@ def add_error(self, msg):
self.form._valid = False
def on_bind(self) -> None:
- form = self.iommi_parent().iommi_parent()
+ form = self.form
if self.attr is MISSING:
self.attr = self._name
if self.display_name is MISSING:
@@ -788,7 +788,7 @@ def _validate_parsed_data(self, value):
return value
def _read_initial(self):
- form = self.iommi_parent().iommi_parent()
+ form = self.form
if self.initial is MISSING and self.include and form.instance is not None:
if self.attr:
initial = self.read_from_instance(self, form.instance)
@@ -805,7 +805,7 @@ def _read_raw_data(self):
self.raw_data_list = evaluate_strict(self.raw_data_list, **self.iommi_evaluate_parameters())
return
- form = self.iommi_parent().iommi_parent()
+ form = self.form
if self.is_list:
if self.raw_data_list is not None:
@@ -849,11 +849,11 @@ def choice_to_options_selected(self):
if self.is_list:
return [
- self.choice_to_option(form=self.iommi_parent(), field=self, choice=v)
+ self.choice_to_option(form=self.form, field=self, choice=v)
for v in self.value
]
else:
- return [self.choice_to_option(form=self.iommi_parent(), field=self, choice=self.value)]
+ return [self.choice_to_option(form=self.form, field=self, choice=self.value)]
@property
def choice_tuples(self):
