Esempio n. 1
0
def class_settings(request):
	if (request.user.is_authenticated() and request.user.is_type("Teacher")):
		name = request.user.first_name + " " + request.user.last_name
        elements = get_header_navbar("Teacher",name,"Class Settings")
        context = Context( { 
			        		'menu' : get_template("teacher_menu.html").render(Context()),
			        		'header' : elements['header'],
			        		'teaching_hierarchy': get_courses(request.user.user_id),
                            'navbar' : elements['navbar'],
                            'add_student' : AddStudentForm(),
                            'years' : range(1,13) #should be added later from DB
		        	})
        return HttpResponse(get_template("class_settings.html").render(context))
	return HttpResponseRedirect("/")
Esempio n. 2
0
def get_set_exercise_page(request):
	if (request.user.is_authenticated() and request.user.is_type("Teacher")):
		template = get_template("set_exercise.html")
		teaching_hierarchy = get_courses(request.user.user_id)
		vsp_context = Context({'form':ViewSpecificationForm()})
		vsp_context.update(csrf(request))
		view_spec_form = get_template("view_spec_form.html").render(vsp_context)
		name = request.user.first_name + " " + request.user.last_name
		elements = get_header_navbar("Teacher",name,"Teaching Overview")
		context = Context( {'header' : elements['header'], 
							'menu' : get_template("teacher_menu.html").render(Context({"page":"set_ex"})),
							'teaching_hierarchy' : teaching_hierarchy,
							'navbar' : elements['navbar'],
							'assignment_book' : get_all_exercises(),
							'vsp_media' : Template("{{form.media}}").render(vsp_context), 
							'view_spec_form' : view_spec_form})
		return HttpResponse(template.render(context))
	return HttpResponseRedirect("/")