def get_list_fields(self):
        """Get all list fields"""
        from trionyx.renderer import renderer
        model_fields = {f.name: f for f in self.model.get_fields(True, True)}

        def create_list_fields(config_fields, list_fields=None):
            list_fields = list_fields if list_fields else {}

            for field in config_fields:
                config = field
                if isinstance(field, str):
                    config = {'field': field}

                if 'field' not in config:
                    raise Exception("Field config is missing field: {}".format(config))
                if 'label' not in config:
                    if config['field'] in model_fields:
                        config['label'] = model_fields[config['field']].verbose_name
                    else:
                        config['label'] = config['field']
                if 'renderer' not in config:
                    config['renderer'] = renderer.render_field

                list_fields[config['field']] = config
            return list_fields

        list_fields = create_list_fields(model_fields.keys())

        if self.list_fields:
            list_fields = create_list_fields(self.list_fields, list_fields)

        return list_fields
def get_list_fields ( self ) : from trionyx . renderer import renderer model_fields = { f . name : f for f in self . model . get_fields ( True , True ) } def create_list_fields ( config_fields , list_fields = None ) : list_fields = list_fields if list_fields else { } for field in config_fields : config = field if isinstance ( field , str ) : config = { 'field' : field } if 'field' not in config : raise Exception ( "Field config is missing field: {}" . format ( config ) ) if 'label' not in config : if config [ 'field' ] in model_fields : config [ 'label' ] = model_fields [ config [ 'field' ] ] . verbose_name else : config [ 'label' ] = config [ 'field' ] if 'renderer' not in config : config [ 'renderer' ] = renderer . render_field list_fields [ config [ 'field' ] ] = config return list_fields list_fields = create_list_fields ( model_fields . keys ( ) ) if self . list_fields : list_fields = create_list_fields ( self . list_fields , list_fields ) return list_fields
Get all list fields