Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _nested_field_list(self, f, fl, *name):
"""Get Nested Fields"""
nested_field_list = {}
for n_f in f.nested_model._meta.field_list.values():
if isinstance(n_f, NestedModel):
n = (*name, n_f.name)
self._nested_field_list(n_f, nested_field_list, *n)
else:
nested_field_list[n_f.db_column_name] = n_f.get_value(
utils.get_nested(self.query, *name).get(n_f.name),
ignore_required=True
)
fl[f.db_column_name] = nested_field_list
def _nested_field_list(self, f, fl, *name):
"""Get Nested Fields"""
required_nested_model = f.raw_attributes.get('required')
if required_nested_model is None or required_nested_model is False:
ignore_required = True
else:
ignore_required = False
nested_field_list = {}
for n_f in f.nested_model._meta.field_list.values():
if isinstance(n_f, NestedModel):
n = (*name, n_f.name)
self._nested_field_list(n_f, nested_field_list, *n)
else:
nv = None
if utils.get_nested(self.query, *name) is not None:
nv = utils.get_nested(self.query, *name).get(n_f.name)
nested_field_list[n_f.db_column_name] = n_f.get_value(
nv,
ignore_required
)
fl[f.db_column_name] = nested_field_list
def _nested_field_list(self, f, fl, *name):
"""Get Nested Fields"""
required_nested_model = f.raw_attributes.get('required')
if required_nested_model is None or required_nested_model is False:
ignore_required = True
else:
ignore_required = False
nested_field_list = {}
for n_f in f.nested_model._meta.field_list.values():
if isinstance(n_f, NestedModel):
n = (*name, n_f.name)
self._nested_field_list(n_f, nested_field_list, *n)
else:
nv = None
if utils.get_nested(self.query, *name) is not None:
nv = utils.get_nested(self.query, *name).get(n_f.name)
nested_field_list[n_f.db_column_name] = n_f.get_value(
nv,
ignore_required
)
fl[f.db_column_name] = nested_field_list