api/study_api.py
def edit_custom_field(study_id=None):
    """Edits the name of a Custom field. Expects field_id anf edit_custom_field in request body"""
    field_id = request.values.get("field_id")
    new_field_name = request.values.get("edit_custom_field")
    if field_id:
        try:
            field = StudyField.objects.get(id=field_id)
        except StudyField.DoesNotExist:
            field = None
        if field and new_field_name:
            field.field_name = new_field_name
            field.save()

    # this apparent insanity is a hopefully unnecessary confirmation of the study id
    return redirect('/study_fields/{:d}'.format(Study.objects.get(pk=study_id).id))
Edits the name of a Custom field. Expects field_id anf edit_custom_field in request body
Edits the name of a Custom field. Expects field_id anf edit_custom_field in request body
Edits the name of a Custom field . Expects field_id anf edit_custom_field in request body
def edit_custom_field(study_id=None):
    field_id = request.values.get("field_id")
    new_field_name = request.values.get("edit_custom_field")
    if field_id:
        try:
            field = StudyField.objects.get(id=field_id)
        except StudyField.DoesNotExist:
            field = None
        if field and new_field_name:
            field.field_name = new_field_name
            field.save()
    return redirect('/study_fields/{:d}'.format(Study.objects.get(pk=study_id).id))
def edit_custom_field ( study_id = None ) : field_id = request . values . get ( "field_id" ) new_field_name = request . values . get ( "edit_custom_field" ) if field_id : try : field = StudyField . objects . get ( id = field_id ) except StudyField . DoesNotExist : field = None if field and new_field_name : field . field_name = new_field_name field . save ( ) return redirect ( '/study_fields/{:d}' . format ( Study . objects . get ( pk = study_id ) . id ) )
Edits the name of a Custom field.
Edits the name of a Custom field .
"""Edits the name of a Custom field. Expects field_id anf edit_custom_field in request body""" # this apparent insanity is a hopefully unnecessary confirmation of the study id

study_id