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
83a2e921
Commit
83a2e921
authored
Nov 26, 2018
by
SANCHIT JAIN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed name of button and created a database file
parent
cb3dfd3e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2597 additions
and
18 deletions
+2597
-18
ARFA/ARFA_app/migrations/0001_initial.py
ARFA/ARFA_app/migrations/0001_initial.py
+4
-5
ARFA/ARFA_app/templates/ARFA_app/create_question.html
ARFA/ARFA_app/templates/ARFA_app/create_question.html
+1
-1
ARFA/ARFA_app/views.py
ARFA/ARFA_app/views.py
+20
-12
ARFA/WITH_USER_question.sql
ARFA/WITH_USER_question.sql
+2572
-0
No files found.
ARFA/ARFA_app/migrations/0001_initial.py
View file @
83a2e921
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1
6 on 2018-11-26 08:5
7
# Generated by Django 1.11.1
5 on 2018-11-26 18:4
7
from
__future__
import
unicode_literals
import
django.core.validators
...
...
@@ -81,7 +81,6 @@ class Migration(migrations.Migration):
(
'difficulty_set'
,
models
.
CharField
(
max_length
=
20
)),
(
'difficulty_observed'
,
models
.
CharField
(
max_length
=
20
)),
(
'question_text'
,
models
.
CharField
(
max_length
=
1000
)),
(
'image_link'
,
models
.
CharField
(
max_length
=
200
)),
(
'num_appeared'
,
models
.
IntegerField
(
default
=
0
)),
(
'num_correct'
,
models
.
IntegerField
(
default
=
0
)),
(
'visibility'
,
models
.
CharField
(
max_length
=
20
)),
...
...
@@ -92,11 +91,11 @@ class Migration(migrations.Migration):
migrations
.
CreateModel
(
name
=
'QuestionImage'
,
fields
=
[
(
'i
d'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'image'
,
models
.
FileField
(
upload_to
=
'QuestionImages/'
)),
(
'i
mage_id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'image'
,
models
.
FileField
(
upload_to
=
'
ARFA_app/static/ARFA_app/
QuestionImages/'
)),
(
'imageDesc'
,
models
.
CharField
(
max_length
=
100
)),
(
'orderNum'
,
models
.
IntegerField
(
default
=
1
)),
(
'q
uestion'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'ARFA_app.Question'
)),
(
'q
_ID'
,
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'ARFA_app.Question'
)),
],
),
migrations
.
CreateModel
(
...
...
ARFA/ARFA_app/templates/ARFA_app/create_question.html
View file @
83a2e921
...
...
@@ -310,7 +310,7 @@ Create Question
<li><button
type=
"button"
class=
"btn btn-default prev-step"
onclick=
"document.getElementById('l2').click() ; "
>
Previous
</button></li>
<li><button
type=
"button"
class=
"btn btn-default next-step"
onclick=
"document.getElementById('l4').click() ;"
>
Skip
</button></li>
<li><button
align=
"left"
type=
"button"
class=
"btn btn-primary"
id=
"addsubjectiveque"
onclick=
"intend_to_add_img() ; post()"
>
Add an image
</button></li>
<li><button
type=
"button"
class=
"btn btn-primary btn-info-full next-step"
onclick=
"
step3()"
>
Save and continue
</button></li>
<li><button
type=
"button"
class=
"btn btn-primary btn-info-full next-step"
onclick=
"
post()"
>
Post Question
</button></li>
</ul>
...
...
ARFA/ARFA_app/views.py
View file @
83a2e921
...
...
@@ -74,17 +74,20 @@ def reg(request):
if
(
request
.
method
==
"POST"
):
role
=
request
.
POST
[
'role'
]
data
=
{
'username'
:
request
.
POST
[
'username'
],
'name'
:
request
.
POST
[
'name'
],
'email_ID'
:
request
.
POST
[
'email_ID'
],
'address'
:
request
.
POST
[
'address'
],
'password'
:
request
.
POST
[
'password'
],
'phone_number'
:
request
.
POST
[
'phone_number'
]}
if
(
role
==
"Student"
):
print
"Student with name "
+
data
[
'name'
]
+
" registered"
s
=
models
.
Student
(
**
data
)
s
.
save
()
else
:
data
[
'salary'
]
=
0
data
[
'subject_ID'
]
=
models
.
Subject
.
objects
.
filter
(
subject_ID
=
request
.
POST
[
'subject_ID'
])
.
get
()
print
"Faculty with name "
+
data
[
'name'
]
+
" registered"
s
=
models
.
Faculty
(
**
data
)
s
.
save
()
try
:
if
(
role
==
"Student"
):
print
"Student with name "
+
data
[
'name'
]
+
" registered"
s
=
models
.
Student
(
**
data
)
s
.
save
()
else
:
data
[
'salary'
]
=
0
data
[
'subject_ID'
]
=
models
.
Subject
.
objects
.
filter
(
subject_ID
=
request
.
POST
[
'subject_ID'
])
.
get
()
print
"Faculty with name "
+
data
[
'name'
]
+
" registered"
s
=
models
.
Faculty
(
**
data
)
s
.
save
()
except
:
print
"registration failed"
return
redirect
(
'/arfa/register'
)
else
:
return
redirect
(
'/arfa'
)
...
...
@@ -620,7 +623,6 @@ def add_question(request):
try
:
question_data
=
dict
(
json
.
loads
(
request
.
POST
[
'client_response'
]))
args
=
question_data
[
'question_data'
]
print
args
[
'question_text'
]
if
args
[
'question_text'
]
==
''
:
...
...
@@ -629,8 +631,11 @@ def add_question(request):
args
[
'faculty'
]
=
models
.
Faculty
.
objects
.
filter
(
username
=
request
.
session
[
'username'
])
.
get
()
print
args
[
'faculty'
]
options
=
question_data
[
'options_details'
]
print
options
args
[
'subject_ID'
]
=
models
.
Subject
.
objects
.
filter
(
subject_ID
=
args
[
'subject_ID'
])
.
get
()
print
args
[
'subject_ID'
]
flag
=
False
for
i
in
range
(
0
,
len
(
options
)):
if
options
[
str
(
i
)][
'option_Value'
]:
...
...
@@ -638,8 +643,11 @@ def add_question(request):
break
if
not
(
flag
):
return
HttpResponse
(
json
.
dumps
({
'status'
:
'Failed'
,
'reason'
:
'No correct option provided'
}))
print
args
question
=
models
.
Question
(
**
args
)
print
question
question
.
save
()
print
"saved"
for
i
in
range
(
0
,
len
(
options
)):
option
=
models
.
Options
(
q_ID
=
question
,
option_Value
=
options
[
str
(
i
)][
'option_Value'
],
is_Answer
=
options
[
str
(
i
)][
'is_Answer'
],
option_ID
=
options
[
str
(
i
)][
'id'
])
...
...
ARFA/WITH_USER_question.sql
0 → 100644
View file @
83a2e921
This diff is collapsed.
Click to expand it.
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