def create(
    user,
    group,
    label,
    position = None,
    visible = None,
    value_type = u"unicode"
):
    """
    Creates a new free defined field

    :param group: Group name
    :param user: Username
    :param label: Label of the field
    :param position: Sort key
    :param visible: Visibility of the field
    :param value_type: "unicode"|"int"|"float"|"date"

    :return: New created and saved FreeDefinedField-Object

    :rtype: model.free_defined_field.FreeDefinedField
    """

    # Check authorization
    authorization.check_authorization(user, authorization.FREE_DEFINED_FIELD_CREATE)

    # Create field
    free_defined_field = FreeDefinedField(
        cu = user,
        group = group,
        label = label,
        position = position,
        visible = visible,
        value_type = value_type
    )

    # Save
    free_defined_field.put()

    # Finished
    return free_defined_field
def create(user,
           group,
           label,
           position=None,
           visible=None,
           value_type=u"unicode"):
    """
    Creates a new free defined field

    :param group: Group name
    :param user: Username
    :param label: Label of the field
    :param position: Sort key
    :param visible: Visibility of the field
    :param value_type: "unicode"|"int"|"float"|"date"

    :return: New created and saved FreeDefinedField-Object

    :rtype: model.free_defined_field.FreeDefinedField
    """

    # Check authorization
    authorization.check_authorization(user,
                                      authorization.FREE_DEFINED_FIELD_CREATE)

    # Create field
    free_defined_field = FreeDefinedField(cu=user,
                                          group=group,
                                          label=label,
                                          position=position,
                                          visible=visible,
                                          value_type=value_type)

    # Save
    free_defined_field.put()

    # Finished
    return free_defined_field
def get_free_defined_fields():
    """
    Returns a list with free defined field objects
    """

    # Query
    query = FreeDefinedField.query()

    # Sorting
    query = query.order(FreeDefinedField.position, FreeDefinedField.label)

    # Fetch adresses
    free_defined_fields = []
    for free_defined_field in query:
        free_defined_fields.append(free_defined_field)

    # Finished
    return free_defined_fields
def get_free_defined_fields():
    """
    Returns a list with free defined field objects
    """

    # Query
    query = FreeDefinedField.query()

    # Sorting
    query = query.order(FreeDefinedField.position, FreeDefinedField.label)

    # Fetch adresses
    free_defined_fields = []
    for free_defined_field in query:
        free_defined_fields.append(free_defined_field)

    # Finished
    return free_defined_fields