Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ARFA
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
ARFA
ARFA
Commits
56194c3a
Commit
56194c3a
authored
Nov 25, 2018
by
NARRA SURAJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test display
parent
06868c56
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
134 additions
and
12 deletions
+134
-12
ARFA/ARFA_app/migrations/0002_auto_20181125_0931.py
ARFA/ARFA_app/migrations/0002_auto_20181125_0931.py
+30
-0
ARFA/ARFA_app/migrations/0003_auto_20181125_1102.py
ARFA/ARFA_app/migrations/0003_auto_20181125_1102.py
+30
-0
ARFA/ARFA_app/models.py
ARFA/ARFA_app/models.py
+2
-2
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
+1
-1
ARFA/ARFA_app/templates/ARFA_app/home.html
ARFA/ARFA_app/templates/ARFA_app/home.html
+1
-1
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
+25
-0
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
+4
-2
ARFA/ARFA_app/urls.py
ARFA/ARFA_app/urls.py
+2
-1
ARFA/ARFA_app/utilities.py
ARFA/ARFA_app/utilities.py
+1
-0
ARFA/ARFA_app/views.py
ARFA/ARFA_app/views.py
+38
-5
No files found.
ARFA/ARFA_app/migrations/0002_auto_20181125_0931.py
0 → 100644
View file @
56194c3a
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-25 09:31
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'ARFA_app'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'test'
,
name
=
'expected_time_for_completion'
,
field
=
models
.
CharField
(
max_length
=
10
),
),
migrations
.
AlterField
(
model_name
=
'test'
,
name
=
'max_marks'
,
field
=
models
.
IntegerField
(
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'test'
,
name
=
'start_time'
,
field
=
models
.
CharField
(
max_length
=
10
),
),
]
ARFA/ARFA_app/migrations/0003_auto_20181125_1102.py
0 → 100644
View file @
56194c3a
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-25 11:02
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'ARFA_app'
,
'0002_auto_20181125_0931'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'test'
,
name
=
'expected_time_for_completion'
,
field
=
models
.
DurationField
(
blank
=
True
),
),
migrations
.
AlterField
(
model_name
=
'test'
,
name
=
'max_marks'
,
field
=
models
.
FloatField
(
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'test'
,
name
=
'start_time'
,
field
=
models
.
DateTimeField
(),
),
]
ARFA/ARFA_app/models.py
View file @
56194c3a
...
@@ -29,8 +29,8 @@ class Test(models.Model):
...
@@ -29,8 +29,8 @@ class Test(models.Model):
test_name
=
models
.
CharField
(
max_length
=
200
,
unique
=
True
)
test_name
=
models
.
CharField
(
max_length
=
200
,
unique
=
True
)
visibility_student
=
models
.
CharField
(
max_length
=
20
)
visibility_student
=
models
.
CharField
(
max_length
=
20
)
ownership
=
models
.
CharField
(
max_length
=
20
)
ownership
=
models
.
CharField
(
max_length
=
20
)
expected_time_for_completion
=
models
.
CharField
(
max_length
=
10
)
expected_time_for_completion
=
models
.
DurationField
(
blank
=
True
)
start_time
=
models
.
CharField
(
max_length
=
10
)
start_time
=
models
.
DateTimeField
(
auto_now
=
False
,
auto_now_add
=
False
)
max_marks
=
models
.
IntegerField
(
null
=
True
)
max_marks
=
models
.
IntegerField
(
null
=
True
)
# class TestQuestions(models.Model):
# class TestQuestions(models.Model):
...
...
ARFA/ARFA_app/templates/ARFA_app/create_Test.html
View file @
56194c3a
...
@@ -36,7 +36,7 @@ Create Test
...
@@ -36,7 +36,7 @@ Create Test
<!-- <li> -->
<!-- <li> -->
<div
class=
"row toggle"
>
<div
class=
"row toggle"
>
<div
class=
"col-xs-10"
>
<div
class=
"col-xs-10"
>
<input
type=
"checkbox"
value=
"True"
name =
"
i
{{question.q_id}}"
>
<input
type=
"checkbox"
value=
"True"
name =
"{{question.q_id}}"
>
{{question.question_text}} {{question.q_id}}
</br>
{{question.question_text}} {{question.q_id}}
</br>
</div>
</div>
</div>
</div>
...
...
ARFA/ARFA_app/templates/ARFA_app/home.html
View file @
56194c3a
...
@@ -255,7 +255,7 @@ profile
...
@@ -255,7 +255,7 @@ profile
<button
type=
"submit"
class=
"btn btn-login float-right"
>
Submit
</button>
<button
type=
"submit"
class=
"btn btn-login float-right"
>
Submit
</button>
</form>
</form>
</ol>
{%endblock%}
{%endblock%}
ARFA/ARFA_app/templates/ARFA_app/loadStudentTest.html
0 → 100644
View file @
56194c3a
{%extends 'base2.html'%}
{%block head%}
{%endblock%}
{%block title%}
{{testName}}
{%endblock%}
{%block body%}
<ol>
<form
class=
"exam-form"
method=
"POST"
action=
"/arfa/result"
>
{% csrf_token %}
<!-- {{ data }} -->
<input
name=
"testID"
value=
"{{testID}}"
type=
"hidden"
>
{% for question, options in questions.items %}
<li
style=
"font-weight: bold;"
>
Question : {{ question }}
</li>
{% for option in options %}
<input
type=
"checkbox"
name =
"{{option.0}}"
value=
"{{option.1}}"
>
{{ option.2 }}
</br>
{% endfor %}
{% endfor %}
<button
type=
"submit"
class=
"btn btn-login float-right"
>
Submit
</button>
</form>
</ol>
{%endblock%}
\ No newline at end of file
ARFA/ARFA_app/templates/ARFA_app/studentTestHome.html
View file @
56194c3a
...
@@ -21,7 +21,8 @@ My Tests
...
@@ -21,7 +21,8 @@ My Tests
<p>
{{t.test_name}}
</p>
<p>
{{t.test_name}}
</p>
</div>
</div>
<div
style=
"float:right"
>
<div
style=
"float:right"
>
<form
method=
"POST"
action=
"loadStudentTest"
>
<form
method=
"POST"
action=
"arfa/loadStudentTest"
>
{% csrf_token %}
<input
name=
"testID"
value=
"{{t.test_ID}}"
type=
"hidden"
>
<input
name=
"testID"
value=
"{{t.test_ID}}"
type=
"hidden"
>
<button>
Load Test
</button>
<button>
Load Test
</button>
</form>
</form>
...
@@ -46,8 +47,9 @@ My Tests
...
@@ -46,8 +47,9 @@ My Tests
</div>
</div>
<div
style=
"float:right"
>
<div
style=
"float:right"
>
<form
method=
"POST"
action=
"loadStudentTest"
>
<form
method=
"POST"
action=
"loadStudentTest"
>
{% csrf_token %}
<input
name=
"testID"
value=
"{{t.test_ID}}"
type=
"hidden"
>
<input
name=
"testID"
value=
"{{t.test_ID}}"
type=
"hidden"
>
<button>
Load Test
</button>
<button
type=
"submit"
>
Load Test
</button>
</form>
</form>
</div>
</div>
{% endfor %}
{% endfor %}
...
...
ARFA/ARFA_app/urls.py
View file @
56194c3a
...
@@ -25,6 +25,7 @@ urlpatterns=[
...
@@ -25,6 +25,7 @@ urlpatterns=[
url
(
r'^add_question'
,
views
.
add_question
),
url
(
r'^add_question'
,
views
.
add_question
),
url
(
r'^register'
,
views
.
register
),
url
(
r'^register'
,
views
.
register
),
url
(
r'^reg'
,
views
.
reg
),
url
(
r'^reg'
,
views
.
reg
),
url
(
r'^studentTestHome'
,
views
.
studentTestHome
)
url
(
r'^studentTestHome'
,
views
.
studentTestHome
),
url
(
r'^loadStudentTest'
,
views
.
loadStudentTest
)
]
]
ARFA/ARFA_app/utilities.py
View file @
56194c3a
...
@@ -8,6 +8,7 @@ from .models import Test
...
@@ -8,6 +8,7 @@ from .models import Test
from
.models
import
Question
from
.models
import
Question
from
.models
import
Options
from
.models
import
Options
from
.models
import
Student
from
.models
import
Student
from
.models
import
Evaluation
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
...
...
ARFA/ARFA_app/views.py
View file @
56194c3a
...
@@ -9,6 +9,8 @@ from .models import Test
...
@@ -9,6 +9,8 @@ from .models import Test
from
.models
import
Question
from
.models
import
Question
from
.models
import
Options
from
.models
import
Options
from
.models
import
Student
from
.models
import
Student
from
.models
import
Contains
from
.models
import
Evaluation
from
.
import
utilities
from
.
import
utilities
from
.utilities
import
evaluate
from
.utilities
import
evaluate
from
.
import
forms
from
.
import
forms
...
@@ -174,9 +176,40 @@ def studentTestHome(request):
...
@@ -174,9 +176,40 @@ def studentTestHome(request):
return
render
(
request
,
'ARFA_app/studentTestHome.html'
,
data
)
return
render
(
request
,
'ARFA_app/studentTestHome.html'
,
data
)
def
loadStudentTest
(
request
):
def
loadStudentTest
(
request
):
if
request
.
method
==
'POST'
:
print
request
.
POST
test_ID
=
request
.
POST
[
'test_ID'
]
if
(
request
.
session
.
get
(
'session'
,
None
)
!=
True
):
return
render
(
request
,
'ARFA_app/login.html'
)
if
request
.
method
==
'GET'
:
return
render
(
request
,
'ARFA_app/home.html'
)
args
=
{}
args
[
'username'
]
=
request
.
session
[
'username'
]
args
[
'is_session'
]
=
True
test_ID
=
request
.
POST
[
'testID'
]
testName
=
Test
.
objects
.
values
(
'test_name'
)
.
get
(
pk
=
test_ID
)
print
testName
questions
=
Contains
.
objects
.
filter
(
test_ID
=
test_ID
)
.
values
(
'q_ID'
)
options
=
models
.
Options
.
objects
.
select_related
(
'q_ID'
)
.
filter
(
q_ID__in
=
questions
)
print
test_ID
print
questions
.
all
()
questionsJSON
=
{}
for
option
in
options
:
if
option
.
q_ID
.
question_text
in
questionsJSON
:
questionsJSON
[
option
.
q_ID
.
question_text
]
.
append
(
[
option
.
q_ID
.
q_ID
,
option
.
pk
,
option
.
option_Value
])
else
:
questionsJSON
[
option
.
q_ID
.
question_text
]
=
[[
option
.
q_ID
.
q_ID
,
option
.
pk
,
option
.
option_Value
]]
# print option.option_Value
# print option.q_ID.q_ID
args
[
'questions'
]
=
questionsJSON
args
[
'testName'
]
=
testName
args
[
'testID'
]
=
test_ID
return
render
(
request
,
'ARFA_app/loadStudentTest.html'
,
args
)
def
testHome
(
request
):
def
testHome
(
request
):
# if request.method == 'GET':
# if request.method == 'GET':
...
@@ -331,7 +364,7 @@ def create_Test(request):
...
@@ -331,7 +364,7 @@ def create_Test(request):
creator
.
save
()
creator
.
save
()
else
:
else
:
if
form
.
errors
:
if
form
.
errors
:
for
field
in
form
:
for
field
in
form
:
print
field
.
errors
print
field
.
errors
return
HttpResponse
(
"Test Form Invalid"
)
return
HttpResponse
(
"Test Form Invalid"
)
...
@@ -344,7 +377,7 @@ def create_Test(request):
...
@@ -344,7 +377,7 @@ def create_Test(request):
pass
pass
containsObj
=
models
.
Contains
(
test_ID
=
test
)
containsObj
=
models
.
Contains
(
test_ID
=
test
)
# print data
for
q
in
data
.
keys
():
for
q
in
data
.
keys
():
if
len
(
data
[
q
])
!=
3
:
if
len
(
data
[
q
])
!=
3
:
continue
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment