

def get_user_toggle(request):
    ufilter = group = individual = show_commtrack = None
    try:
        request_obj = (request.POST if (request.method == 'POST') else request.GET)
        if request_obj.get('ufilter', ''):
            ufilter = request_obj.getlist('ufilter')
        group = request_obj.get('group', '')
        individual = request_obj.get('individual', '')
        show_commtrack = request.project.commtrack_enabled
    except (KeyError, AttributeError):
        pass
    show_filter = True
    toggle = (HQUserType.commtrack_defaults() if show_commtrack else HQUserType.use_defaults())
    if (ufilter and (not (group or individual))):
        toggle = HQUserType.use_filter(ufilter)
    elif (group or individual):
        show_filter = False
    return (toggle, show_filter)

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/reports/filters/users.py get_user_toggle/original