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
07c37cb4
Commit
07c37cb4
authored
Nov 26, 2018
by
CHINTHAREDDY SAI CHARITH REDDY
Browse files
Options
Browse Files
Download
Plain Diff
Test Performance
parents
39812351
83a2e921
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2596 additions
and
17 deletions
+2596
-17
ARFA/ARFA_app/migrations/0001_initial.py
ARFA/ARFA_app/migrations/0001_initial.py
+3
-4
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 @
07c37cb4
...
...
@@ -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 @
07c37cb4
...
...
@@ -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 @
07c37cb4
...
...
@@ -76,17 +76,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'
)
...
...
@@ -613,7 +616,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'
]
==
''
:
...
...
@@ -622,8 +624,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'
]:
...
...
@@ -631,8 +636,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 @
07c37cb4
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