Exemple #1
0
def view_spec(request):
	if (request.user.is_authenticated() and request.user.is_type("Teacher")) :
		template = get_template("view_spec.html")
		name = request.user.first_name + " " + request.user.last_name
		elements = get_header_navbar("Teacher",name,"View Specification")
		context = Context(
				{ 'header' : elements['header'],
				  'navbar' : elements['navbar'],
				  'menu' : get_template("teacher_menu.html").render(Context({"page":"view_spec"})),
				  'editor' : SubmitCodeForm(),
				  'assignment_book': get_all_exercises()
				})
		return HttpResponse(template.render(context))
	return HttpResponseRedirect("/")
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("/")