Generate a custom representation of table's fields in dictionary type
        if exist edit form else use default representation.

        :return: dict
15160
def generate_data_for_edit_page(self):
        

        if not self.can_edit:
            return {}

        if self.edit_form:
            return self.edit_form.to_dict()

        return self.generate_simple_data_page()
957572
def asDictionary(self):
        
        template =  {
            "type": "dataLayer",
            "dataSource": self._dataSource
        }
        if not self._fields is None:
            template['fields'] = self._fields
        return template
1296256
def fieldmap(self):
        '''
        
        '''
        if hasattr(self, '_sql_fieldmap') and self._sql_fieldmap:
            fieldmap = self._sql_fieldmap
        else:
            fieldmap = defaultdict(str)
            fields = copy(self.fields)
            for field, opts in fields.iteritems():
                field_id = opts.get('what')
                if field_id is not None:
                    fieldmap[field_id] = field
            self._sql_fieldmap = fieldmap
        return fieldmap
231757
def to_dict(self):
        """"""
        return {'schema': self.schema, 'name': self.name, 'columns': [col.to_dict() for col in self._columns],
                'foreign_keys': self.foreign_keys.to_dict(), 'ref_keys': self.ref_keys.to_dict()}
124619
def _get_table_info(self):
        """"""
        self.fields = []
        self.field_info = {}
        self.cursor.execute('PRAGMA table_info (%s)' %self.name)
        for field_info in self.cursor.fetchall():
            fname = field_info[1].encode('utf-8')
            self.fields.append(fname)
            ftype = field_info[2].encode('utf-8')
            info = {'type':ftype}
            # can be null ?
            info['NOT NULL'] = field_info[3] != 0
            # default value
            default = field_info[4]
            if isinstance(default,unicode):
               default = guess_default_fmt(default)
            info['DEFAULT'] = default
            self.field_info[fname] = info
163241
def make_dict(self, field_values):
        ''' 
        '''
        data_dict = {}
        for key, value, field_type, converter in zip(self.field_names, field_values, self.field_types, self.type_converters):
            try:
                # We have to deal with the '-' based on the field_type
                data_dict[key] = self.dash_mapper.get(field_type, '-') if value == '-' else converter(value)
            except ValueError as exc:
                print('Conversion Issue for key:{:s} value:{:s}\n{:s}'.format(key, str(value), str(exc)))
                data_dict[key] = value
                if self._strict:
                    raise exc

        return data_dict
910087
def asDictionary(self):
        
        template = {
            "type" : "uniqueValue",
            "field1" : self._field1,
            "field2" : self._field2,
            "field3" : self._field3,
            "fieldDelimiter" : self._fieldDelimiter,
            "defaultSymbol" :  self._defaultSymbol.asDictionary,
            "defaultLabel" : self._defaultLabel,
            "uniqueValueInfos" : self._uniqueValueInfos,
            "rotationType": self._rotationType,
            "rotationExpression": self._rotationExpression
        }
        return template
1219704
def dict(
        self, *, include: 'SetStr' = None, exclude: 'SetStr' = None, by_alias: bool = False, skip_defaults: bool = False
    ) -> 'DictStrAny':
        
        get_key = self._get_key_factory(by_alias)
        get_key = partial(get_key, self.fields)

        return_keys = self._calculate_keys(include=include, exclude=exclude, skip_defaults=skip_defaults)
        if return_keys is None:
            return {get_key(k): v for k, v in self._iter(by_alias=by_alias, skip_defaults=skip_defaults)}
        else:
            return {
                get_key(k): v for k, v in self._iter(by_alias=by_alias, skip_defaults=skip_defaults) if k in return_keys
            }
24842
def form_field_definitions(self):
        
        schema = copy.deepcopy(form_field_definitions.user)
        uid, login = self._get_auth_attrs()
        if uid != login:
            field = schema.get(login, schema['default'])
            if field['chain'].find('*optional_login') == -1:
                field['chain'] = '%s:%s' % (
                    '*optional_login', field['chain'])
                if not field.get('custom'):
                    field['custom'] = dict()
                field['custom']['optional_login'] = \
                    (['context.optional_login'], [], [], [], [])
            schema[login] = field
        return schema
414624
def _dictionary(self):
        # type: () -> Dict[str, Any]
        
        # NOTE: Dictionaries are not populated if not loaded. So, conditionals
        #       are not needed here.
        retval = {}

        for variant in self._override_order:
            retval.update(self._config[variant])

        return retval
800149
def get_table_description(self, cursor, table_name):
        ""
        # pylint:disable=too-many-locals,unused-argument
        result = []
        for field in self.table_description_cache(table_name)['fields']:
            params = OrderedDict()
            if field['label'] and field['label'] != camel_case_to_spaces(re.sub('__c$', '', field['name'])).title():
                params['verbose_name'] = field['label']
            if not field['updateable'] or not field['createable']:
                # Fields that are result of a formula or system fields modified
                # by triggers or by other apex code
                sf_read_only = (0 if field['updateable'] else 1) | (0 if field['createable'] else 2)
                # use symbolic names NOT_UPDATEABLE, NON_CREATABLE, READ_ONLY instead of 1, 2, 3
                params['sf_read_only'] = reverse_models_names[sf_read_only]
            if field['defaultValue'] is not None:
                params['default'] = field['defaultValue']
            if field['inlineHelpText']:
                params['help_text'] = field['inlineHelpText']
            if field['picklistValues']:
                params['choices'] = [(x['value'], x['label']) for x in field['picklistValues'] if x['active']]
            if field['defaultedOnCreate'] and field['createable']:
                params['default'] = SymbolicModelsName('DEFAULTED_ON_CREATE')
            if field['type'] == 'reference' and not field['referenceTo']:
                params['ref_comment'] = 'No Reference table'
                field['type'] = 'string'
            if field['calculatedFormula']:
                # calculated formula field are without length in Salesforce 45 Spring '19,
                # but Django requires a length, though the field is read only and never written
                field['length'] = 1300
            # We prefer "length" over "byteLength" for "internal_size".
            # (because strings have usually: byteLength == 3 * length)
            result.append(FieldInfo(
                field['name'],       # name,
                field['type'],       # type_code,
                field['length'],     # display_size,
                field['length'],     # internal_size,
                field['precision'],  # precision,
                field['scale'],      # scale,
                field['nillable'],   # null_ok,
                params.get('default'),  # default
                params,
            ))
        return result
599109
def to_dict(self):
        
        if not hasattr(self, '_fields'):
            return self.__dict__
        result = dict()
        for field_name, field in self._fields.items():
            if isinstance(field, xmlmap.NodeField):
                obj = getattr(self, field_name)
                if obj is None:
                    result[field_name] = None
                elif not hasattr(obj, 'to_dict'):
                    result[field_name] = obj.__dict__
                else:
                    result[field_name] = obj.to_dict()
            elif isinstance(field, xmlmap.NodeListField):
                objs = getattr(self, field_name)
                result[field_name] = list()
                for obj in objs:
                    if not hasattr(obj, 'to_dict'):
                        result[field_name].append(obj.__dict__)
                    else:
                        result[field_name].append(obj.to_dict())
            else:
                result[field_name] = getattr(self, field_name)
        return result
45411
def fields(self):
        
        result = self._get_key_values('fields')
        for key, value in result.items():
            if not isinstance(value, list):
                result[key] = [value]

        for key, value in result.items():
            schema = get_schema_from_type(key)
            for obj in value:
                if obj not in schema._declared_fields:
                    raise InvalidField("{} has no attribute {}".format(schema.__name__, obj))

        return result
1279116
def to_dict(self):
        
        obj_dict = super(Table, self).to_dict()
        rows_dict = [r.to_dict() for r in self.rows]
        child_dict = {
            'type': self.__class__.__name__,
            'caption': self.caption,
            'rows': rows_dict
        }
        obj_dict.update(child_dict)
        return obj_dict
278828
def fields(self):
        
        return {k:getattr(self, k, None) for k in self.schema.fields}
267535
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self,
                   'customization_id') and self.customization_id is not None:
            _dict['customization_id'] = self.customization_id
        if hasattr(self, 'created') and self.created is not None:
            _dict['created'] = self.created
        if hasattr(self, 'language') and self.language is not None:
            _dict['language'] = self.language
        if hasattr(self, 'versions') and self.versions is not None:
            _dict['versions'] = self.versions
        if hasattr(self, 'owner') and self.owner is not None:
            _dict['owner'] = self.owner
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'description') and self.description is not None:
            _dict['description'] = self.description
        if hasattr(self,
                   'base_model_name') and self.base_model_name is not None:
            _dict['base_model_name'] = self.base_model_name
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'progress') and self.progress is not None:
            _dict['progress'] = self.progress
        if hasattr(self, 'warnings') and self.warnings is not None:
            _dict['warnings'] = self.warnings
        return _dict
1074223
def to_api_repr(self):
        
        # Put together the basic representation. See http://bit.ly/2hOAT5u.
        answer = {
            "mode": self.mode.upper(),
            "name": self.name,
            "type": self.field_type.upper(),
            "description": self.description,
        }

        # If this is a RECORD type, then sub-fields are also included,
        # add this to the serialized representation.
        if self.field_type.upper() == "RECORD":
            answer["fields"] = [f.to_api_repr() for f in self.fields]

        # Done; return the serialized dictionary.
        return answer