Esempio n. 1
0
def semester_contributor_ready(request, semester_id):
    semester = get_object_or_404(Semester, id=semester_id)
    courses = semester.course_set.filter(
        state__in=['new', 'lecturerApproved']).all()

    forms = helper_create_grouped_course_selection_forms(
        courses, lambda course: not course.warnings(), request)

    valid = helper_are_course_selection_forms_valid(forms)

    if valid:
        selected_courses = []
        for form in forms:
            for course in form.selected_courses:
                course.ready_for_contributors(False)
                course.save()
                selected_courses.append(course)

        EmailTemplate.get_review_template().send_courses(selected_courses,
                                                         send_to_editors=True)

        messages.add_message(
            request, messages.INFO,
            _("Successfully marked %d courses as ready for lecturer review.") %
            (len(selected_courses)))
        return redirect('evap.fsr.views.semester_view', semester_id)
    else:
        return render_to_response("fsr_semester_contributor_ready.html",
                                  dict(semester=semester, forms=forms),
                                  context_instance=RequestContext(request))
Esempio n. 2
0
File: views.py Progetto: mswart/EvaP
def semester_lecturer_ready(request, semester_id):
    semester = get_object_or_404(Semester, id=semester_id)
    form = SelectCourseForm(semester.course_set.filter(state__in=['new', 'lecturerApproved']).all(), lambda course: not course.warnings(), request.POST or None)
    
    if form.is_valid():
        for course in form.selected_courses:
            course.ready_for_lecturer(False)
            course.save()
        
        print form.selected_courses
        EmailTemplate.get_review_template().send_courses(form.selected_courses, True, False)
        
        return redirect('evap.fsr.views.semester_view', semester.id)
    else:
        return render_to_response("fsr_semester_lecturer_ready.html", dict(semester=semester, form=form), context_instance=RequestContext(request))
Esempio n. 3
0
def semester_contributor_ready(request, semester_id):
    semester = get_object_or_404(Semester, id=semester_id)
    courses = semester.course_set.filter(state__in=['new', 'lecturerApproved']).all()
    
    forms = helper_create_grouped_course_selection_forms(courses, lambda course: not course.warnings(), request)
    
    valid = helper_are_course_selection_forms_valid(forms)
    
    if valid:
        selected_courses = []
        for form in forms:
            for course in form.selected_courses:
                course.ready_for_contributors(False)
                course.save()
                selected_courses.append(course)
        
        EmailTemplate.get_review_template().send_courses(selected_courses, True, False, False)
        
        messages.add_message(request, messages.INFO, _("Successfully marked %d courses as ready for lecturer review.") % (len(selected_courses)))
        return redirect('evap.fsr.views.semester_view', semester_id)
    else:
        return render_to_response("fsr_semester_contributor_ready.html", dict(semester=semester, forms=forms), context_instance=RequestContext(request))
Esempio n. 4
0
 def ready_for_contributors(self, send_mail=True):
     if send_mail:
         EmailTemplate.get_review_template().send_courses([self], send_to_editors=True)
Esempio n. 5
0
 def ready_for_lecturer(self, send_mail=True):
     if send_mail:
         EmailTemplate.get_review_template().send_courses([self], True, False)
Esempio n. 6
0
 def ready_for_contributors(self, send_mail=True):
     if send_mail:
         EmailTemplate.get_review_template().send_courses(
             [self], send_to_editors=True)