How to use the fireo.utils.utils.get_nested function in fireo

To help you get started, we’ve selected a few fireo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github octabytes / FireO / src / fireo / queries / update_query.py View on Github external
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
github octabytes / FireO / src / fireo / queries / create_query.py View on Github external
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
github octabytes / FireO / src / fireo / queries / create_query.py View on Github external
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