api/participant_administration.py
def reset_device():
    """
    Resets a participant's device. The participant will not be able to connect until they
    register a new device.
    """

    patient_id = request.values['patient_id']
    study_id = request.values['study_id']

    try:
        participant = Participant.objects.get(patient_id=patient_id)
    except Participant.DoesNotExist:
        flash(f'The participant {patient_id} does not exist', 'danger')
        return redirect(f'/view_study/{study_id}/')

    if participant.study.id != int(study_id):
        flash(f'Participant {patient_id} is not in study {Study.objects.get(id=study_id).name}', 'danger')
        return redirect(request.referrer)

    participant.device_id = ""
    participant.save()
    flash(f'For patient {patient_id}, device was reset; password is untouched. ', 'success')
    return redirect(request.referrer)

    Resets a participant's device. The participant will not be able to connect until they
    register a new device.
    
Resets a participant's device. The participant will not be able to connect until they
register a new device.
Resets a participant ' s device . The participant will not be able to connect until they register a new device .
def reset_device():
    patient_id = request.values['patient_id']
    study_id = request.values['study_id']
    try:
        participant = Participant.objects.get(patient_id=patient_id)
    except Participant.DoesNotExist:
        flash(f'The participant {patient_id} does not exist', 'danger')
        return redirect(f'/view_study/{study_id}/')
    if participant.study.id != int(study_id):
        flash(f'Participant {patient_id} is not in study {Study.objects.get(id=study_id).name}', 'danger')
        return redirect(request.referrer)
    participant.device_id = ""
    participant.save()
    flash(f'For patient {patient_id}, device was reset; password is untouched. ', 'success')
    return redirect(request.referrer)
def reset_device ( ) : patient_id = request . values [ 'patient_id' ] study_id = request . values [ 'study_id' ] try : participant = Participant . objects . get ( patient_id = patient_id ) except Participant . DoesNotExist : flash ( f'The participant {patient_id} does not exist' , 'danger' ) return redirect ( f'/view_study/{study_id}/' ) if participant . study . id != int ( study_id ) : flash ( f'Participant {patient_id} is not in study {Study.objects.get(id=study_id).name}' , 'danger' ) return redirect ( request . referrer ) participant . device_id = "" participant . save ( ) flash ( f'For patient {patient_id}, device was reset; password is untouched. ' , 'success' ) return redirect ( request . referrer )
Resets a participant's device.
Resets a participant ' s device .
"""
    Resets a participant's device. The participant will not be able to connect until they
    register a new device.
    """