Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Pariksha
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roshan Rabinarayan
Pariksha
Commits
d980ce4b
Commit
d980ce4b
authored
Oct 20, 2020
by
Roshan Rabinarayan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add submission to the quiz
parent
b2696eb8
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
38 additions
and
7 deletions
+38
-7
db.sqlite3
db.sqlite3
+0
-0
quiz/__pycache__/admin.cpython-38.pyc
quiz/__pycache__/admin.cpython-38.pyc
+0
-0
quiz/__pycache__/models.cpython-38.pyc
quiz/__pycache__/models.cpython-38.pyc
+0
-0
quiz/__pycache__/views.cpython-38.pyc
quiz/__pycache__/views.cpython-38.pyc
+0
-0
quiz/admin.py
quiz/admin.py
+2
-1
quiz/migrations/0005_auto_20201020_0755.py
quiz/migrations/0005_auto_20201020_0755.py
+18
-0
quiz/migrations/__pycache__/0005_auto_20201020_0755.cpython-38.pyc
...ations/__pycache__/0005_auto_20201020_0755.cpython-38.pyc
+0
-0
quiz/models.py
quiz/models.py
+1
-1
quiz/static/script.js
quiz/static/script.js
+4
-1
quiz/templates/index.html
quiz/templates/index.html
+5
-2
quiz/templates/upload.html
quiz/templates/upload.html
+1
-1
quiz/views.py
quiz/views.py
+7
-1
No files found.
db.sqlite3
View file @
d980ce4b
No preview for this file type
quiz/__pycache__/admin.cpython-38.pyc
View file @
d980ce4b
No preview for this file type
quiz/__pycache__/models.cpython-38.pyc
View file @
d980ce4b
No preview for this file type
quiz/__pycache__/views.cpython-38.pyc
View file @
d980ce4b
No preview for this file type
quiz/admin.py
View file @
d980ce4b
...
@@ -2,5 +2,6 @@ from django.contrib import admin
...
@@ -2,5 +2,6 @@ from django.contrib import admin
# Register your models here.
# Register your models here.
from
.models
import
Questions
from
.models
import
Questions
from
.models
import
submission
admin
.
site
.
register
(
Questions
)
admin
.
site
.
register
(
Questions
)
admin
.
site
.
register
(
submission
)
quiz/migrations/0005_auto_20201020_0755.py
0 → 100644
View file @
d980ce4b
# Generated by Django 2.2.7 on 2020-10-20 07:55
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'quiz'
,
'0004_auto_20201020_0733'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'questions'
,
name
=
'questionId'
,
field
=
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
),
),
]
quiz/migrations/__pycache__/0005_auto_20201020_0755.cpython-38.pyc
0 → 100644
View file @
d980ce4b
File added
quiz/models.py
View file @
d980ce4b
quiz/static/script.js
View file @
d980ce4b
window
.
onload
=
initall
;
window
.
onload
=
initall
;
var
save
;
var
save
;
var
quizId
;
var
questionId
;
function
initall
()
{
function
initall
()
{
save
=
document
.
getElementById
(
'
save_ans
'
)
//save_ans
save
=
document
.
getElementById
(
'
save_ans
'
)
//save_ans
save
.
onclick
=
save_ans
;
save
.
onclick
=
save_ans
;
}
}
function
save_ans
()
{
function
save_ans
()
{
var
ans
=
$
(
"
input:radio[name=name]:checked
"
).
val
()
var
ans
=
$
(
"
input:radio[name=name]:checked
"
).
val
()
var
url
=
'
/save_ans?ans=
'
+
ans
var
url
=
'
/save_ans?ans=
'
+
ans
+
'
&quizId=
'
+
document
.
getElementById
(
'
quizId
'
).
innerHTML
+
'
&questionId=
'
+
document
.
getElementById
(
'
questionId
'
).
innerHTML
var
req
=
new
XMLHttpRequest
();
var
req
=
new
XMLHttpRequest
();
req
.
onreadystatechange
=
function
()
{
req
.
onreadystatechange
=
function
()
{
if
(
this
.
readyState
==
4
&&
this
.
status
==
200
)
{
if
(
this
.
readyState
==
4
&&
this
.
status
==
200
)
{
...
...
quiz/templates/index.html
View file @
d980ce4b
...
@@ -8,9 +8,12 @@
...
@@ -8,9 +8,12 @@
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"
></script>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"
></script>
</head>
</head>
<body>
<body>
<center><h1>
Question {{ questions.end_index }} of {{count}}
</h1></center>
<center><h1>
{{questions.quizId}}Question {{ questions.end_index }} of {{count}}
</h1></center>
<div
>
<div
>
{% for i in questions%}
{% for i in questions%}
<h1
id =
'quizId'
>
{{i.quizId}}
<h1><h1
id =
'questionId'
hidden
>
{{i.questionId}}
</h1>
<h1>
{{i.question}}
</h1>
<h1>
{{i.question}}
</h1>
<form>
<form>
<div
>
<div
>
...
@@ -28,7 +31,7 @@
...
@@ -28,7 +31,7 @@
</form>
</form>
{%endfor%}
{%endfor%}
<div
>
<div
>
<button
id=
"save_ans"
clicked
>
Submit Answer
</button>
<button
id=
"save_ans"
>
Submit Answer
</button>
</div>
</div>
<div
>
<div
>
<div>
<div>
...
...
quiz/templates/upload.html
View file @
d980ce4b
quiz/views.py
View file @
d980ce4b
...
@@ -4,6 +4,7 @@ from . models import Questions
...
@@ -4,6 +4,7 @@ from . models import Questions
from
django.core.paginator
import
Paginator
from
django.core.paginator
import
Paginator
from
.forms
import
UploadFileForm
from
.forms
import
UploadFileForm
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
from
.models
import
submission
from
.
newQuiz
import
readCSV
from
.
newQuiz
import
readCSV
import
csv
import
csv
lst
=
[]
lst
=
[]
...
@@ -19,7 +20,7 @@ for i in answers:
...
@@ -19,7 +20,7 @@ for i in answers:
negative
.
append
(
i
.
negative
)
negative
.
append
(
i
.
negative
)
def
index
(
request
):
def
index
(
request
):
obj
=
Questions
.
objects
.
all
(
)
obj
=
Questions
.
objects
.
get_queryset
()
.
order_by
(
'questionId'
)
count
=
Questions
.
objects
.
all
()
.
count
()
count
=
Questions
.
objects
.
all
()
.
count
()
paginator
=
Paginator
(
obj
,
1
)
paginator
=
Paginator
(
obj
,
1
)
try
:
try
:
...
@@ -50,6 +51,11 @@ def result(request):
...
@@ -50,6 +51,11 @@ def result(request):
def
save_ans
(
request
):
def
save_ans
(
request
):
ans
=
request
.
GET
[
'ans'
]
ans
=
request
.
GET
[
'ans'
]
quizId
=
request
.
GET
[
'quizId'
]
questionId
=
request
.
GET
[
'questionId'
]
studentId
=
1
# initialize here student id
t
=
submission
(
questionId
=
questionId
,
option
=
ans
,
quizId
=
quizId
,
studentId
=
studentId
)
t
.
save
()
lst
.
append
(
ans
)
lst
.
append
(
ans
)
return
HttpResponse
(
''
)
return
HttpResponse
(
''
)
...
...
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