diff options
-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() |