Commit 9f92e584 authored by Sanchit's avatar Sanchit

graph display issue

parent 31c8c403
......@@ -33,6 +33,7 @@ urlpatterns = [
path('save_cribs/',a.save_cribs,name="savecribs"),
path('result/',a.result,name="result"),
url(r'^upload/',TemplateView.as_view(template_name = 'upload.html')),
url(r'^instructor/',TemplateView.as_view(template_name = 'instructor.html')),
path('uploaded/',a.upload_file,name="uploaded"), path('sign_up/',a.sign_up,name="sign-up"), path('accounts/',include('django.contrib.auth.urls'))
]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>Hello Everyone</h1>
<form><input type="hidden" id="quizId" name="quizId" value="123"></form>
<div id="dashboard">
{{ graph|safe }}
{{ graph1|safe }}
{{ graph2|safe }}
</div>
</body>
</html>
\ No newline at end of file
......@@ -35,16 +35,15 @@
height:35px; width:80%; margin-left:19%;" type = "submit" value = "Login" >
<strong>Login</strong>
</button>
</center>
</div>
<br><br>
<div id="dashboard">
{{ graph|safe }}
{{ graph1|safe }}
{{ graph2|safe }}
</div>
</form>
<br><h1><a href="/instructor?quiz_id=123">Instructor Graphs</a></h1>
</body>
</html>
\ No newline at end of file
......@@ -137,15 +137,18 @@ def upload_file(request):
return HttpResponse('success')
else :
q_id=request.POST.get('quizId')
students = result.objects.all().filter(quizId=q_id).values('studentId')
marks=result.objects.all().filter(quizId=q_id).values('marks')
fig, ax = plt.subplots()
ax.scatter([1, 10], [5, 9])
html_graph = mpld3.fig_to_html(fig)
return render(request,'upload.html',{"graph": html_graph, "graph1": html_graph, "graph2": html_graph})
return render(request,'upload.html',{temp1:'invalid File'})
def instructor(request):
q_id = request.GET['quizId']
students = result.objects.all().filter(quizId=q_id).values('studentId')
marks = result.objects.all().filter(quizId=q_id).values('marks')
fig, ax = plt.subplots()
ax.scatter([1, 10], [5, 9])
html_graph = mpld3.fig_to_html(fig)
return render(request, 'instructor.html', {"graph": html_graph, "graph1": html_graph, "graph2": html_graph})
def handle_uploaded_file(f,q1):
with open('name.csv', 'wb+') as destination:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment