api/participant_administration.py
def unregister_participant():
    """
    Block participant from uploading further data
    """

    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)

    if participant.unregistered:
        flash(f'Participant {patient_id} is already unregistered', 'danger')
        return redirect(request.referrer)

    participant.unregistered = True
    participant.save()
    flash(f'{patient_id} was successfully unregisted from the study. They will not be able to upload further data. ', 'danger')
    return redirect(request.referrer)

    Block participant from uploading further data
    
Block participant from uploading further data
Block participant from uploading further data
def unregister_participant():
    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)
    if participant.unregistered:
        flash(f'Participant {patient_id} is already unregistered', 'danger')
        return redirect(request.referrer)
    participant.unregistered = True
    participant.save()
    flash(f'{patient_id} was successfully unregisted from the study. They will not be able to upload further data. ', 'danger')
    return redirect(request.referrer)
def unregister_participant ( ) : 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 ) if participant . unregistered : flash ( f'Participant {patient_id} is already unregistered' , 'danger' ) return redirect ( request . referrer ) participant . unregistered = True participant . save ( ) flash ( f'{patient_id} was successfully unregisted from the study. They will not be able to upload further data. ' , 'danger' ) return redirect ( request . referrer )
Block participant from uploading further data
Block participant from uploading further data
"""
    Block participant from uploading further data
    """