def save_free_defined_field( user, key_urlsafe = None, group = None, label = None, position = None, visible = None, value_type = None ): """ Saves one free_defined_field :param user: Username :param key_urlsafe: Key :param group: Group name :param label: Label :param position: Sort key :param visible: Visibility of the field :param value_type: "unicode"|"int"|"float"|"date" :return: Edited FreeDefinedField-Object :rtype: model.free_defined_field.FreeDefinedField """ # Load original free defined field free_defined_field = get_free_defined_field(key_urlsafe = key_urlsafe) # Check authorization authorization.check_authorization(user, authorization.FREE_DEFINED_FIELD_EDIT) # Check arguments and set values if group is not None: free_defined_field.group = group if label is not None: free_defined_field.label = label if position is not None: free_defined_field.position = position if visible is not None: free_defined_field.visible = visible if value_type is not None: free_defined_field.value_type = value_type # save changes free_defined_field.put() # Return saved field return free_defined_field
def save_free_defined_field(user, key_urlsafe=None, group=None, label=None, position=None, visible=None, value_type=None): """ Saves one free_defined_field :param user: Username :param key_urlsafe: Key :param group: Group name :param label: Label :param position: Sort key :param visible: Visibility of the field :param value_type: "unicode"|"int"|"float"|"date" :return: Edited FreeDefinedField-Object :rtype: model.free_defined_field.FreeDefinedField """ # Load original free defined field free_defined_field = get_free_defined_field(key_urlsafe=key_urlsafe) # Check authorization authorization.check_authorization(user, authorization.FREE_DEFINED_FIELD_EDIT) # Check arguments and set values if group is not None: free_defined_field.group = group if label is not None: free_defined_field.label = label if position is not None: free_defined_field.position = position if visible is not None: free_defined_field.visible = visible if value_type is not None: free_defined_field.value_type = value_type # save changes free_defined_field.put() # Return saved field 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 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