예제 #1
0
파일: views.py 프로젝트: Inkbug/lernanta
def course_change_term( request, course_id, term ):
    cohort_uri = course_model.get_course_cohort_uri( course_id )
    if term == 'fixed':
        form = CourseTermForm(request.POST)
        if form.is_valid():
            course_model.update_cohort(
                cohort_uri,
                term=term.upper(),
                start_date=form.cleaned_data['start_date'],
                end_date=form.cleaned_data['end_date']
            )
        else:
            messages.error( request, _("Could not update fixed term dates"))
    elif term == 'rolling':
        course_model.update_cohort(cohort_uri, term=term.upper())
    redirect_url = reverse('courses_settings', kwargs={'course_id': course_id})
    return http.HttpResponseRedirect(redirect_url)
예제 #2
0
파일: views.py 프로젝트: incommon/lernanta
def course_change_term( request, course_id, term ):
    cohort_uri = course_model.get_course_cohort_uri( course_id )
    if term == 'fixed':
        form = CourseTermForm(request.POST)
        if form.is_valid():
            course_model.update_cohort(
                cohort_uri,
                term=term.upper(),
                start_date=form.cleaned_data['start_date'],
                end_date=form.cleaned_data['end_date']
            )
        else:
            messages.error( request, _("Could not update fixed term dates"))
    elif term == 'rolling':
        course_model.update_cohort(cohort_uri, term=term.upper())
    redirect_url = reverse('courses_settings', kwargs={'course_id': course_id})
    return http.HttpResponseRedirect(redirect_url)
예제 #3
0
파일: views.py 프로젝트: Inkbug/lernanta
def course_change_signup( request, course_id ):
    form = CohortSignupForm(request.POST)
    if form.is_valid():
        signup = form.cleaned_data['signup']
        cohort_uri = course_model.get_course_cohort_uri(course_id)
        cohort = course_model.update_cohort(cohort_uri, signup=signup.upper())
        if not cohort:
            messages.error( request, _("Could not change cohort signup"))
    else:
        request.messages.error(request, _("Invalid choice for signup"))
    redirect_url = reverse('courses_settings', kwargs={'course_id': course_id})
    return http.HttpResponseRedirect(redirect_url)
예제 #4
0
파일: views.py 프로젝트: incommon/lernanta
def course_change_signup( request, course_id ):
    form = CohortSignupForm(request.POST)
    if form.is_valid():
        signup = form.cleaned_data['signup']
        cohort_uri = course_model.get_course_cohort_uri(course_id)
        cohort = course_model.update_cohort(cohort_uri, signup=signup.upper())
        if not cohort:
            messages.error( request, _("Could not change cohort signup"))
    else:
        request.messages.error(request, _("Invalid choice for signup"))
    redirect_url = reverse('courses_settings', kwargs={'course_id': course_id})
    return http.HttpResponseRedirect(redirect_url)