def find(name): if extra_fields and name in extra_fields: return FieldPlaceholder(extra_fields[name]) p = props.get(name) if p is not None: return p raise ValueError('Invalid model property name %s.%s' % (model, name))
def find(name): # If field is in extra_fields, it has higher priority if extra_fields and name in extra_fields: return name, FieldPlaceholder(extra_fields[name]) column, path = get_field_with_path(model, name) if path and not hasattr(column.prop, 'direction'): raise Exception("form column is located in another table and " "requires inline_models: {0}".format(name)) name = column.key if column is not None and hasattr(column, 'property'): return name, column.property raise ValueError('Invalid model property name %s.%s' % (model, name))
def find(name): # If field is in extra_fields, it has higher priority if extra_fields and name in extra_fields: return FieldPlaceholder(extra_fields[name]) # Try to look it up in properties list first p = props.get(name) if p is not None: return p # If it is hybrid property or alias, look it up in a model itself p = getattr(model, name, None) if p is not None and hasattr(p, 'property'): return p.property raise ValueError('Invalid model property name %s.%s' % (model, name))
def find(name): # If field is in extra_fields, it has higher priority if extra_fields and name in extra_fields: return name, FieldPlaceholder(extra_fields[name]) column, path = get_field_with_path(model, name, return_remote_proxy_attr=False) if path and not (is_relationship(column) or is_association_proxy(column)): raise Exception("form column is located in another table and " "requires inline_models: {0}".format(name)) if is_association_proxy(column): return name, column relation_name = column.key if column is not None and hasattr(column, 'property'): return relation_name, column.property raise ValueError('Invalid model property name %s.%s' % (model, name))