Commit 4bab9768 authored by Rahul-chunduru's avatar Rahul-chunduru

ui for view test

parent 26fb4de6
...@@ -29,9 +29,9 @@ class Test(models.Model): ...@@ -29,9 +29,9 @@ class Test(models.Model):
test_name = models.CharField(max_length=200,unique=True) test_name = models.CharField(max_length=200,unique=True)
visibility_student = models.CharField(max_length=20) visibility_student = models.CharField(max_length=20)
ownership = models.CharField(max_length=20) ownership = models.CharField(max_length=20)
expected_time_for_completion = models.DurationField(blank=True) expected_time_for_completion = models.CharField(max_length=10)
start_time = models.DateTimeField(auto_now=False, auto_now_add=False) start_time = models.CharField(max_length=10)
max_marks = models.FloatField(null=True) max_marks = models.IntegerField(null=True)
# class TestQuestions(models.Model): # class TestQuestions(models.Model):
# test_ID = models.ForeignKey( # test_ID = models.ForeignKey(
......
...@@ -24,10 +24,9 @@ Create Test ...@@ -24,10 +24,9 @@ Create Test
{%for question in questions%} {%for question in questions%}
<li class="list-group-item"> <li class="list-group-item">
<!-- <li> --> <!-- <li> -->
<input type="checkbox" value= "True" name = "{{question.q_id}}" >
<div class="row toggle"> <div class="row toggle">
<div class="col-xs-10"> <div class="col-xs-10">
<input type="checkbox" value= "True" name = "i{{question.q_id}}" >
{{question.question_text}} {{question.q_id}} </br> {{question.question_text}} {{question.q_id}} </br>
</div> </div>
</div> </div>
......
...@@ -323,8 +323,8 @@ def create_Test(request): ...@@ -323,8 +323,8 @@ def create_Test(request):
return render(request,'ARFA_app/create_Test.html',args) return render(request,'ARFA_app/create_Test.html',args)
if TestForm.is_valid(): if TestForm.is_valid():
test = TestForm.save() test = TestForm.save()
# for attr in dir(Test): # for attr in dir(Test):
# print attr # print attr
# try: # try:
...@@ -337,26 +337,31 @@ def create_Test(request): ...@@ -337,26 +337,31 @@ def create_Test(request):
# test = Test() # test = Test()
containsObj = models.Contains(test_ID=test) containsObj = models.Contains(test_ID=test)
for q in data.keys(): for q in data.keys():
try: # try:
print q
if q[0] != 'i': if q[0] != 'i':
continue ; continue ;
q = q[1:]
int(q) int(q)
containsObj.q_ID_id = q containsObj.q_ID_id = q
print q
#data[q] is an array ['True', 'pos_marks', 'neg_marks'] #data[q] is an array ['True', 'pos_marks', 'neg_marks']
containsObj.marks_pos = data[q + "1"] containsObj.marks_pos = data[q + "1"]
containsObj.marks_neg = data[q + "2"] containsObj.marks_neg = data[q + "2"]
print data[q + "1"]
containsObj.pk = None containsObj.pk = None
containsObj.save() containsObj.save()
except ValueError as e: print "success"
print containsObj
# except ValueError as e:
data.pop(q) data.pop(q)
print e
continue continue
# for q in data: # for q in data:
print data #print data
return render(request,'ARFA_app/view_personal_Test.html',args) return render(request,'ARFA_app/view_personal_Test.html',args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment