Commit 4c265abf authored by Sanchit's avatar Sanchit

Please solve graph display issue

parent a6863140
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N806" />
<option value="N803" />
<option value="N802" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="quiz.models.*" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Pariksha.iml" filepath="$PROJECT_DIR$/.idea/Pariksha.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
No preview for this file type
# Generated by Django 3.1.2 on 2020-11-02 15:26
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('quiz', '0003_auto_20201030_2026'),
]
operations = [
migrations.CreateModel(
name='result',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('marks', models.IntegerField(default=0, max_length=10)),
('quizId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz')),
('studentId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
from quiz.views import student
from django.db import models
from django.contrib.auth.models import User
import datetime
......@@ -50,3 +49,8 @@ class cribs(models.Model):
quizId=models.ForeignKey(quiz,to_field='quizId',on_delete=models.CASCADE)
questionId=models.ForeignKey(Questions,to_field='questionId',on_delete=models.CASCADE)
class result(models.Model):
studentId = models.ForeignKey(to=User, on_delete=models.CASCADE)
quizId = models.ForeignKey(quiz, to_field='quizId', on_delete=models.CASCADE)
marks=models.IntegerField(max_length=10,default=0)
\ No newline at end of file
......@@ -38,7 +38,12 @@
</center>
</div>
<br><br>
<div id="dashboard">
{{ graph|safe }}
{{ graph1|safe }}
{{ graph2|safe }}
</div>
</form>
</body>
......
......@@ -17,7 +17,7 @@ from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import login
from django.contrib.auth.decorators import login_required
from django.db.models import Count
import matplotlib.pyplot as plt, mpld3
lst = []
answers = []
......@@ -127,7 +127,13 @@ def upload_file(request):
return HttpResponse('success')
else :
return render(request,'upload.html',{temp1:'invalid File'})
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})
......
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