validator/fields.py
def create_field(field_info):
    """
    Create a field by field info dict.
    """
    field_type = field_info.get('type')
    if field_type not in FIELDS_NAME_MAP:
        raise ValueError(_('not support this field: {}').format(field_type))
    field_class = FIELDS_NAME_MAP.get(field_type)
    params = dict(field_info)
    params.pop('type')
    return field_class.from_dict(params)
def create_field(field_info):
    field_type = field_info.get('type')
    if field_type not in FIELDS_NAME_MAP:
        raise ValueError(_('not support this field: {}').format(field_type))
    field_class = FIELDS_NAME_MAP.get(field_type)
    params = dict(field_info)
    params.pop('type')
    return field_class.from_dict(params)
def create_field ( field_info ) : field_type = field_info . get ( 'type' ) if field_type not in FIELDS_NAME_MAP : raise ValueError ( _ ( 'not support this field: {}' ) . format ( field_type ) ) field_class = FIELDS_NAME_MAP . get ( field_type ) params = dict ( field_info ) params . pop ( 'type' ) return field_class . from_dict ( params )
Create a field by field info dict.
Create a field by field info dict .