Commit 2117467a authored by Roshan Rabinarayan's avatar Roshan Rabinarayan

corrected graphs code

parent 9f92e584
...@@ -33,7 +33,7 @@ urlpatterns = [ ...@@ -33,7 +33,7 @@ urlpatterns = [
path('save_cribs/',a.save_cribs,name="savecribs"), path('save_cribs/',a.save_cribs,name="savecribs"),
path('result/',a.result,name="result"), path('result/',a.result,name="result"),
url(r'^upload/',TemplateView.as_view(template_name = 'upload.html')), url(r'^upload/',TemplateView.as_view(template_name = 'upload.html')),
url(r'^instructor/',TemplateView.as_view(template_name = 'instructor.html')), url('instructor/',a.instructor,name='instructor'),
path('uploaded/',a.upload_file,name="uploaded"), path('sign_up/',a.sign_up,name="sign-up"), path('accounts/',include('django.contrib.auth.urls')) 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) ]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
<h1>Hello Everyone</h1> <h1>Hello Everyone</h1>
<form><input type="hidden" id="quizId" name="quizId" value="123"></form> <form><input type="hidden" id="quizId" name="quizId" value="123"></form>
<div id="dashboard"> <div id="dashboard">
{{ graph|safe }} {{quiz_id}}
{{ graph1|safe }} {{graph|safe}}
{{ graph2|safe }} {{graph1|safe}}
{{graph2|safe}}
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -141,13 +141,15 @@ def upload_file(request): ...@@ -141,13 +141,15 @@ def upload_file(request):
def instructor(request): def instructor(request):
q_id = request.GET['quizId'] print('Hello World')
students = result.objects.all().filter(quizId=q_id).values('studentId') q_id = request.GET['quiz_id']
marks = result.objects.all().filter(quizId=q_id).values('marks') print(q_id)
students = results.objects.all().filter(quizId=q_id).values('studentId')
marks = results.objects.all().filter(quizId=q_id).values('marks')
fig, ax = plt.subplots() fig, ax = plt.subplots()
ax.scatter([1, 10], [5, 9]) ax.scatter([1, 10], [5, 9])
html_graph = mpld3.fig_to_html(fig) html_graph = mpld3.fig_to_html(fig)
return render(request, 'instructor.html', {"graph": html_graph, "graph1": html_graph, "graph2": html_graph}) return render(request, 'instructor.html',{"graph": html_graph, "graph1": html_graph, "graph2": html_graph,'quiz_id':q_id})
def handle_uploaded_file(f,q1): def handle_uploaded_file(f,q1):
......
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