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
784d2f15
Commit
784d2f15
authored
Oct 20, 2020
by
Roshan Rabinarayan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamicmarking,questionmodel modified
parent
e8f27753
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
104 additions
and
30 deletions
+104
-30
db.sqlite3
db.sqlite3
+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/migrations/0002_auto_20201020_0343.py
quiz/migrations/0002_auto_20201020_0343.py
+23
-0
quiz/migrations/0003_auto_20201020_0359.py
quiz/migrations/0003_auto_20201020_0359.py
+38
-0
quiz/migrations/__pycache__/0002_auto_20201020_0343.cpython-38.pyc
...ations/__pycache__/0002_auto_20201020_0343.cpython-38.pyc
+0
-0
quiz/migrations/__pycache__/0003_auto_20201020_0359.cpython-38.pyc
...ations/__pycache__/0003_auto_20201020_0359.cpython-38.pyc
+0
-0
quiz/models.py
quiz/models.py
+6
-0
quiz/templates/result.html
quiz/templates/result.html
+13
-13
quiz/templates/student.html
quiz/templates/student.html
+9
-9
quiz/views.py
quiz/views.py
+15
-8
No files found.
db.sqlite3
View file @
784d2f15
No preview for this file type
quiz/__pycache__/models.cpython-38.pyc
View file @
784d2f15
No preview for this file type
quiz/__pycache__/views.cpython-38.pyc
View file @
784d2f15
No preview for this file type
quiz/migrations/0002_auto_20201020_0343.py
0 → 100644
View file @
784d2f15
# Generated by Django 2.2.7 on 2020-10-20 03:43
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'quiz'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'questions'
,
name
=
'marks'
,
field
=
models
.
IntegerField
(
default
=
1
,
max_length
=
3
),
),
migrations
.
AddField
(
model_name
=
'questions'
,
name
=
'negative'
,
field
=
models
.
IntegerField
(
default
=
0
,
max_length
=
3
),
),
]
quiz/migrations/0003_auto_20201020_0359.py
0 → 100644
View file @
784d2f15
# Generated by Django 2.2.7 on 2020-10-20 03:59
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'quiz'
,
'0002_auto_20201020_0343'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'questions'
,
name
=
'explainations'
,
field
=
models
.
TextField
(
default
=
'No Explaination Given'
,
max_length
=
1000
),
),
migrations
.
AddField
(
model_name
=
'questions'
,
name
=
'quizId'
,
field
=
models
.
CharField
(
default
=
10
,
max_length
=
100
),
),
migrations
.
AddField
(
model_name
=
'questions'
,
name
=
'type'
,
field
=
models
.
CharField
(
default
=
1
,
max_length
=
10
),
),
migrations
.
AlterField
(
model_name
=
'questions'
,
name
=
'marks'
,
field
=
models
.
IntegerField
(
default
=
1
),
),
migrations
.
AlterField
(
model_name
=
'questions'
,
name
=
'negative'
,
field
=
models
.
FloatField
(
default
=
0
,
max_length
=
10
),
),
]
quiz/migrations/__pycache__/0002_auto_20201020_0343.cpython-38.pyc
0 → 100644
View file @
784d2f15
File added
quiz/migrations/__pycache__/0003_auto_20201020_0359.cpython-38.pyc
0 → 100644
View file @
784d2f15
File added
quiz/models.py
View file @
784d2f15
...
...
@@ -10,3 +10,9 @@ class Questions(models.Model):
option3
=
models
.
CharField
(
max_length
=
100
)
option4
=
models
.
CharField
(
max_length
=
100
)
answer
=
models
.
CharField
(
max_length
=
100
)
type
=
models
.
CharField
(
max_length
=
10
,
default
=
1
)
marks
=
models
.
IntegerField
(
default
=
1
)
negative
=
models
.
FloatField
(
max_length
=
10
,
default
=
0
)
explainations
=
models
.
TextField
(
max_length
=
1000
,
default
=
'No Explaination Given'
)
quizId
=
models
.
CharField
(
max_length
=
100
,
default
=
10
)
#questionId=models.AutoField(default=10)
quiz/templates/result.html
View file @
784d2f15
<!DOCTYPE html>
<head>
<head>
<title>
Result Page
</title>
</head>
<body>
</head>
<body>
<div>
<center><a
href=
"/showAnswers/"
><h3>
Your Score {{score}}
</h3></a></center>
</div>
<script
src=
"https://code.jquery.com/jquery-3.5.1.slim.min.js"
></script>
</body>
</html>
</body>
</html>
quiz/templates/student.html
View file @
784d2f15
<!DOCTYPE html>
<head>
<head>
<title>
Pariksha
</title>
</head>
<body>
</head>
<body>
<center><h1><a
href=
"/quiz/"
>
Start Quiz
</a></h1></center>
</body>
</html>
</body>
</html>
quiz/views.py
View file @
784d2f15
...
...
@@ -3,12 +3,16 @@ from django.http import HttpResponse
from
.
models
import
Questions
from
django.core.paginator
import
Paginator
lst
=
[]
answers
=
Questions
.
objects
.
all
()
#print("hello"+str(answers))
anslist
=
[]
marksList
=
[]
negative
=
[]
for
i
in
answers
:
anslist
.
append
(
i
.
answer
)
print
(
str
(
i
.
answer
))
marksList
.
append
(
i
.
marks
)
negative
.
append
(
i
.
negative
)
def
index
(
request
):
obj
=
Questions
.
objects
.
all
()
...
...
@@ -20,18 +24,22 @@ def index(request):
page
=
1
try
:
questions
=
paginator
.
page
(
page
)
except
(
EmptyPage
,
InvalidPage
)
:
except
Exception
as
e
:
questions
=
paginator
.
page
(
paginator
.
num_pages
)
return
render
(
request
,
'index.html'
,{
'obj'
:
obj
,
'questions'
:
questions
,
'count'
:
count
})
'''
def index(request):
pass
'''
def
result
(
request
):
score
=
0
for
i
in
range
(
len
(
lst
)):
if
lst
[
i
]
==
anslist
[
i
]:
score
+=
1
score
+=
marksList
[
i
]
else
:
score
-=
negative
[
i
]
return
render
(
request
,
'result.html'
,{
'score'
:
score
,
'lst'
:
lst
})
...
...
@@ -42,5 +50,4 @@ def save_ans(request):
def
student
(
request
):
lst
.
clear
()
return
render
(
request
,
'student.html'
)
# Create your views here.
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