<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def updateSeriesAttributes(request):
    '''
    This function handles the filtering of available series classes and seriesteachers when a series
    is chosen on the Substitute Teacher reporting form.
    '''
    if request.method == 'POST' and request.POST.get('event'):
        series_option = request.POST.get('event') or None
        seriesClasses = EventOccurrence.objects.filter(event__id=series_option)
        seriesTeachers = SeriesTeacher.objects.filter(event__id=series_option)
    else:
        # Only return attributes for valid requests
        return JsonResponse({})

    outClasses = {}
    for option in seriesClasses:
        outClasses[str(option.id)] = option.__str__()

    outTeachers = {}
    for option in seriesTeachers:
        outTeachers[str(option.id)] = option.__str__()

    return JsonResponse({
        'id_occurrences': outClasses,
        'id_replacedStaffMember': outTeachers,
    })