Commit 64e7c5b6 authored by SANCHIT JAIN's avatar SANCHIT JAIN

some interface improvement

parent a00a3eaa
...@@ -32,4 +32,4 @@ VISIBILITY_CHOICES= ('1980', '1981', '1982') ...@@ -32,4 +32,4 @@ VISIBILITY_CHOICES= ('1980', '1981', '1982')
class TestForm(forms.ModelForm): class TestForm(forms.ModelForm):
class Meta: class Meta:
model = Test model = Test
exclude = ['test_ID', 'ownsership'] exclude = ['test_ID', 'ownership']
\ No newline at end of file \ No newline at end of file
...@@ -7,18 +7,11 @@ ...@@ -7,18 +7,11 @@
Create Test Create Test
{%endblock%} {%endblock%}
{%block head%}
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>
{%endblock%}
{%block body%} {%block body%}
<h1> You CAN CREATE A Test HERE prof {{username}}</h1> <h1> You CAN CREATE A Test HERE prof {{username}}</h1>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<div class="container"> <div class="container">
<div class="panel-default"> <div class="panel-default">
<div class="panel-heading"> <div class="panel-heading">
......
...@@ -56,14 +56,21 @@ profile ...@@ -56,14 +56,21 @@ profile
<div class="col-md-6 no-pad"> <div class="col-md-6 no-pad">
<div class="user-pad"> <div class="user-pad">
<h3>Welcome back, {{name}}</h3> <h3>Welcome back, {{name}}</h3>
<h4 class="white"><i class="fa fa-check-circle"></i> contact:{{phone_number}}</h4> {% if phone_number %}
<h4 class="white"><i class="fa fa-check-circle"></i>ID: {{email_ID}}</h4> <h4 class="white"><i class="fa fa-phone"></i> contact:{{phone_number}}</h4>
<h4 class="white"><i class="fa fa-twitter"></i>address: {{address}}</h4> {% endif%}
{% if email_ID%}
<h4 class="white"><i class="fa fa-mail-bulk"></i> ID: {{email_ID}}</h4>
{% endif %}
{% if address%}
<h4 class="white"><i class="fa fa-home"></i> address: {{address}}</h4>
{% endif %}
<button type="button" class="btn btn-labeled btn-info" href="#"> <button type="button" class="btn btn-labeled btn-info" href="#">
<span class="btn-label"><i class="fa fa-pencil"></i></span>Update</button> <span class="btn-label"><i class="fa fa-edit"></i></span>Update</button>
</div> </div>
</div> </div>
<div class="col-md-6 no-pad"> <div class="col-md-6 no-pad">
<!-- <i class="fa fa-user fa-10x" style="transform: translate(50%,30%);"></i> -->
<div class="user-image"> <div class="user-image">
{% load static %} {% load static %}
<img src="{% static 'ARFA_app/prof_male.png' %}" style="width: 100%" class="img-responsive thumbnail"> <img src="{% static 'ARFA_app/prof_male.png' %}" style="width: 100%" class="img-responsive thumbnail">
...@@ -72,17 +79,17 @@ profile ...@@ -72,17 +79,17 @@ profile
</div> </div>
<div class="row overview"> <div class="row overview">
<div class="col-md-4 user-pad text-center"> <div class="col-md-4 user-pad text-center">
<h3>Tests Given</h3> <h3>Tests Created</h3>
<h4>2,784</h4> <h4>{{ test_created}}</h4>
</div> </div>
<div class="col-md-4 user-pad text-center"> <div class="col-md-4 user-pad text-center">
<h3>Rank</h3> <h3>Personal Questions</h3>
<h4>456</h4> <h4>{{ personal_questions}}</h4>
</div>
<div class="col-md-4 user-pad text-center">
<h3>Questions Solved</h3>
<h4>4,901</h4>
</div> </div>
<!-- <div class="col-md-4 user-pad text-center">
<h3>Questions Accessible</h3>
<h4>{{ questions_accessible }}</h4>
</div> -->
</div> </div>
</div> </div>
<div class="col-md-1 user-menu-btns"> <div class="col-md-1 user-menu-btns">
......
...@@ -62,11 +62,17 @@ profile ...@@ -62,11 +62,17 @@ profile
<div class="col-md-6 no-pad"> <div class="col-md-6 no-pad">
<div class="user-pad"> <div class="user-pad">
<h3>Welcome back, {{name}}</h3> <h3>Welcome back, {{name}}</h3>
<h4 class="white"><i class="fa fa-check-circle"></i> contact:{{phone_number}}</h4> {% if phone_number %}
<h4 class="white"><i class="fa fa-check-circle"></i>ID: {{email_ID}}</h4> <h4 class="white"><i class="fa fa-phone"></i> contact:{{phone_number}}</h4>
<h4 class="white"><i class="fa fa-home"></i>address: {{address}}</h4> {% endif%}
{% if email_ID%}
<h4 class="white"><i class="fa fa-mail-bulk"></i> ID: {{email_ID}}</h4>
{% endif %}
{% if address%}
<h4 class="white"><i class="fa fa-home"></i> address: {{address}}</h4>
{% endif %}
<button type="button" class="btn btn-labeled btn-info" href="#"> <button type="button" class="btn btn-labeled btn-info" href="#">
<span class="btn-label"><i class="fa fa-pencil"></i></span>Update</button> <span class="btn-label"><i class="fa fa-edits"></i></span>Update</button>
</div> </div>
</div> </div>
<div class="col-md-6 no-pad"> <div class="col-md-6 no-pad">
...@@ -79,15 +85,16 @@ profile ...@@ -79,15 +85,16 @@ profile
<div class="row overview"> <div class="row overview">
<div class="col-md-4 user-pad text-center"> <div class="col-md-4 user-pad text-center">
<h3>Tests Given</h3> <h3>Tests Given</h3>
<h4>2,784</h4> <h4>{{tests_given}}</h4>
</div> </div>
<div class="col-md-4 user-pad text-center"> <div class="col-md-4 user-pad text-center">
<h3>Rank</h3> <h3>Questions Solved</h3>
<h4>456</h4> <h4>{{questions_solved}}</h4>
</div> </div>
<div class="col-md-4 user-pad text-center"> <div class="col-md-4 user-pad text-center">
<h3>Questions Solved</h3> <h3>Best Rank</h3>
<h4>4,901</h4> <!-- TODO: Find rank relative to other students -->
<h4>5</h4>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -91,6 +91,10 @@ def students(request): ...@@ -91,6 +91,10 @@ def students(request):
args2=request.session.get('args',None) args2=request.session.get('args',None)
if args2!=None: if args2!=None:
args.update(args2) args.update(args2)
tests_given=models.Takes.objects.filter(student=args['user']).count()
question_solved=models.Responses.objects.filter(student=args['users']).annotate("q_ID").count()
args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3)
print "Rendering All students Page" print "Rendering All students Page"
return render(request,'ARFA_app/students.html',args) return render(request,'ARFA_app/students.html',args)
...@@ -101,6 +105,10 @@ def faculty(request): ...@@ -101,6 +105,10 @@ def faculty(request):
args2=request.session.get('args',None) args2=request.session.get('args',None)
if args2!=None: if args2!=None:
args.update(args2) args.update(args2)
personal_questions=models.Question.objects.filter(faculty=args['user']).count()
test_created=models.Created_BY.objects.filter(faculty=args['user']).count()
args3={'personal_questions':personal_questions,'test_created':test_created}
args.update(args3)
print "Rendering All faculty Page" print "Rendering All faculty Page"
return render(request,'ARFA_app/faculty.html',args) return render(request,'ARFA_app/faculty.html',args)
...@@ -133,11 +141,21 @@ def profile(request): ...@@ -133,11 +141,21 @@ def profile(request):
print "Detected A session " print "Detected A session "
if(request.session.get('role',None)=="student"): if(request.session.get('role',None)=="student"):
args=request.session.get('args',None) args=request.session.get('args',None)
tests_given=models.Takes.objects.filter(student=args['username']).count()
question_solved=models.Responses.objects.filter(student=args['username']).annotate("q_ID").count()
args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3)
print "rendering student home for student "+args['name'] print "rendering student home for student "+args['name']
return render(request,'ARFA_app/home.html',args) return render(request,'ARFA_app/home.html',args)
else: else:
args=request.session.get('args',None) args=request.session.get('args',None)
print "rendering student home for faculty "+args['name'] personal_questions=models.Question.objects.filter(faculty=args['username']).count()
test_created=models.Created_BY.objects.filter(faculty=args['username']).count()
args3={'personal_questions':personal_questions,'test_created':test_created}
args.update(args3)
print "rendering faculty home for faculty "+args['name']
return render(request,'ARFA_app/faculty_home.html',args) return render(request,'ARFA_app/faculty_home.html',args)
else: else:
print "No session Detected" print "No session Detected"
...@@ -150,7 +168,6 @@ def profile(request): ...@@ -150,7 +168,6 @@ def profile(request):
else: else:
request.session['username'] = args['user'] request.session['username'] = args['user']
request.session['session'] = True request.session['session'] = True
request.session.get('role',None)
request.session['role']=authenticated['role'] request.session['role']=authenticated['role']
args={ args={
'name':authenticated["object"].name, 'name':authenticated["object"].name,
...@@ -163,9 +180,18 @@ def profile(request): ...@@ -163,9 +180,18 @@ def profile(request):
} }
request.session['args']=args request.session['args']=args
if(authenticated['role']=="student"): if(authenticated['role']=="student"):
print("session before render "+str(request.session.get('session',None))) tests_given=models.Takes.objects.filter(student=args['user']).count()
question_solved=models.Responses.objects.filter(student=args['users']).annotate("q_ID").count()
args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3)
# print("session before render "+str(request.session.get('session',None)))
return render(request,'ARFA_app/home.html',args) return render(request,'ARFA_app/home.html',args)
else: else:
personal_questions=models.Question.objects.filter(faculty=args['user']).count()
test_created=models.Created_BY.objects.filter(faculty=args['user']).count()
args3={'personal_questions':personal_questions,'test_created':test_created}
args.update(args3)
return render(request,'ARFA_app/faculty_home.html',args) return render(request,'ARFA_app/faculty_home.html',args)
else: else:
......
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