diff options
author | ankitjavalkar | 2020-03-27 15:44:08 +0530 |
---|---|---|
committer | ankitjavalkar | 2020-03-27 15:44:08 +0530 |
commit | d7bc376400a610fa2760e05cfb7781050a08dc7b (patch) | |
tree | fd59c4ffa6d7def6d98283c6e6a4a0da8097f7ba | |
parent | e8573822d3ed25306d5d2faf946633f2c17997b0 (diff) | |
download | online_test-d7bc376400a610fa2760e05cfb7781050a08dc7b.tar.gz online_test-d7bc376400a610fa2760e05cfb7781050a08dc7b.tar.bz2 online_test-d7bc376400a610fa2760e05cfb7781050a08dc7b.zip |
Allow stdio expected input to be optional and miscellanous UI fixes
-rw-r--r-- | yaksh/templates/yaksh/add_question.html | 16 | ||||
-rw-r--r-- | yaksh/views.py | 5 |
2 files changed, 19 insertions, 2 deletions
diff --git a/yaksh/templates/yaksh/add_question.html b/yaksh/templates/yaksh/add_question.html index 17cdcfe..342e8ae 100644 --- a/yaksh/templates/yaksh/add_question.html +++ b/yaksh/templates/yaksh/add_question.html @@ -127,6 +127,22 @@ <h3>Test Cases</h3> </div> <div class="card-body"> + {% if question %} + <div class="row"> + <div class="col pb-4"> + <tr><td>Add Test Case:</td> + <td> + <select id="case_type" class="form-control" name="case_type" onchange="frm.submit()"> + <option value="" selected="selected">Select Testcase</option> + {% for key, value in testcase_options %} + <option value="{{key}}">{{value}}</option> + {% endfor %} + </select> + </td> + </tr> + </div> + </div> + {% endif %} {% for formset in formsets %} {{ formset.management_form }} <div id="accordion"> diff --git a/yaksh/views.py b/yaksh/views.py index b54461f..873c227 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -103,8 +103,9 @@ def get_html_text(md_text): def formfield_callback(field): - if (isinstance(field, models.TextField) and field.name == 'expected_output' - or field.name == 'expected_input'): + if (isinstance(field, models.TextField) and field.name == 'expected_input'): + return fields.CharField(strip=False, required = False) + if (isinstance(field, models.TextField) and field.name == 'expected_output'): return fields.CharField(strip=False) return field.formfield() |