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
db8d03bc
Commit
db8d03bc
authored
Oct 24, 2020
by
Roshan Rabinarayan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic signup/login
parent
6abc8062
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
37 additions
and
5 deletions
+37
-5
QuizSystem/__pycache__/settings.cpython-38.pyc
QuizSystem/__pycache__/settings.cpython-38.pyc
+0
-0
QuizSystem/__pycache__/urls.cpython-38.pyc
QuizSystem/__pycache__/urls.cpython-38.pyc
+0
-0
QuizSystem/settings.py
QuizSystem/settings.py
+1
-0
QuizSystem/urls.py
QuizSystem/urls.py
+3
-2
db.sqlite3
db.sqlite3
+0
-0
quiz/__pycache__/views.cpython-38.pyc
quiz/__pycache__/views.cpython-38.pyc
+0
-0
quiz/templates/registration/login.html
quiz/templates/registration/login.html
+5
-0
quiz/templates/registration/logout.html
quiz/templates/registration/logout.html
+1
-0
quiz/templates/registration/signup.html
quiz/templates/registration/signup.html
+5
-0
quiz/templates/student.html
quiz/templates/student.html
+2
-1
quiz/views.py
quiz/views.py
+20
-2
No files found.
QuizSystem/__pycache__/settings.cpython-38.pyc
View file @
db8d03bc
No preview for this file type
QuizSystem/__pycache__/urls.cpython-38.pyc
View file @
db8d03bc
No preview for this file type
QuizSystem/settings.py
View file @
db8d03bc
...
...
@@ -121,3 +121,4 @@ USE_TZ = True
STATIC_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'static'
)
STATIC_URL
=
'/static/'
STATICFILES_DIRS
=
(
os
.
path
.
join
(
BASE_DIR
,
'statics'
),)
LOGIN_REDIRECT_URL
=
'student'
QuizSystem/urls.py
View file @
db8d03bc
...
...
@@ -21,15 +21,16 @@ from django.conf import settings
from
django.conf.urls
import
url
from
django.views.generic
import
TemplateView
from
django.conf.urls.static
import
static
from
django.urls
import
path
,
include
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
''
,
a
.
student
),
path
(
''
,
a
.
student
,
name
=
"student"
),
path
(
'quiz/'
,
a
.
index
),
path
(
'save_ans/'
,
a
.
save_ans
,
name
=
"saveans"
),
path
(
'save_cribs/'
,
a
.
save_cribs
,
name
=
"savecribs"
),
path
(
'result/'
,
a
.
result
,
name
=
"result"
),
url
(
r'^upload/'
,
TemplateView
.
as_view
(
template_name
=
'upload.html'
)),
path
(
'uploaded/'
,
a
.
upload_file
,
name
=
"uploaded"
)
path
(
'uploaded/'
,
a
.
upload_file
,
name
=
"uploaded"
)
,
path
(
'sign_up/'
,
a
.
sign_up
,
name
=
"sign-up"
),
path
(
'accounts/'
,
include
(
'django.contrib.auth.urls'
))
]
+
static
(
settings
.
STATIC_URL
,
document_root
=
settings
.
STATIC_ROOT
)
db.sqlite3
View file @
db8d03bc
No preview for this file type
quiz/__pycache__/views.cpython-38.pyc
View file @
db8d03bc
No preview for this file type
quiz/templates/registration/login.html
0 → 100644
View file @
db8d03bc
<form
method=
"post"
>
{% csrf_token %}
{{form.as_p}}
<input
type=
"submit"
value=
"Login"
>
</form>
\ No newline at end of file
quiz/templates/registration/logout.html
0 → 100644
View file @
db8d03bc
<h1>
You are now logged out {{ user }}
</h1>
quiz/templates/registration/signup.html
0 → 100644
View file @
db8d03bc
<form
method=
"post"
>
{% csrf_token %}
{{form.as_p}}
<input
type=
"submit"
value=
"Sign up"
>
</form>
\ No newline at end of file
quiz/templates/student.html
View file @
db8d03bc
...
...
@@ -5,6 +5,7 @@
</head>
<body>
<center><h1><a
href=
"/quiz/"
>
Start Quiz
</a></h1></center>
<center><h1><a>
Welcome Student{{user}}
</a></h1>
<br><h1><a
href=
"/quiz/"
>
Start Quiz
</a></h1></center>
</body>
</html>
quiz/views.py
View file @
db8d03bc
...
...
@@ -8,6 +8,12 @@ from .models import submission
from
.models
import
cribs
from
.
newQuiz
import
readCSV
import
csv
#for login
from
django.contrib.auth.models
import
User
from
django.contrib.auth.forms
import
UserCreationForm
from
django.contrib.auth
import
login
from
django.contrib.auth.decorators
import
login_required
lst
=
[]
answers
=
[]
...
...
@@ -44,7 +50,6 @@ def result(request):
j
=
2
score
=
0
while
j
<=
i
-
2
:
#print(str(request.POST[ans[j-1]])+" :"+str(request.POST[ans[j]]))
q
=
Questions
.
objects
.
all
()
.
filter
(
quizId
=
quizId
,
questionId
=
request
.
POST
[
ans
[
j
-
1
]])
.
values
()
#fetch the given quiz answers marks and negative marking
if
(
len
(
q
)
>=
1
):
...
...
@@ -87,7 +92,7 @@ def save_cribs(request):
def
upload
(
request
):
return
render
(
request
,
'upload.html'
)
#@login_required
def
student
(
request
):
lst
.
clear
()
return
render
(
request
,
'student.html'
)
...
...
@@ -118,3 +123,16 @@ def handle_uploaded_file(f):
q
.
save
()
#login functionality
def
sign_up
(
request
):
context
=
{}
form
=
UserCreationForm
(
request
.
POST
or
None
)
if
request
.
method
==
"POST"
:
if
form
.
is_valid
():
user
=
form
.
save
()
login
(
request
,
user
)
return
render
(
request
,
'student.html'
)
context
[
'form'
]
=
form
return
render
(
request
,
'registration/signup.html'
,
context
)
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