diff options
author | adityacp | 2020-08-28 12:49:32 +0530 |
---|---|---|
committer | adityacp | 2020-08-28 12:49:32 +0530 |
commit | 348a6a5b0786ffc28cb988c1fcc62232a7e57fc2 (patch) | |
tree | 76e06c9cca9dd8e03170dddecbcd5c30bcaebde7 | |
parent | 052ac313e9f38e43cf16a3ae1f7f77cc58802529 (diff) | |
download | online_test-348a6a5b0786ffc28cb988c1fcc62232a7e57fc2.tar.gz online_test-348a6a5b0786ffc28cb988c1fcc62232a7e57fc2.tar.bz2 online_test-348a6a5b0786ffc28cb988c1fcc62232a7e57fc2.zip |
Release changes
-rw-r--r-- | yaksh/migrations/0021_auto_20200703_1556.py | 25 | ||||
-rw-r--r-- | yaksh/migrations/0022_release_0_22_1.py | 30 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 6 | ||||
-rw-r--r-- | yaksh/templatetags/custom_filters.py | 23 |
4 files changed, 81 insertions, 3 deletions
diff --git a/yaksh/migrations/0021_auto_20200703_1556.py b/yaksh/migrations/0021_auto_20200703_1556.py new file mode 100644 index 0000000..713b2d8 --- /dev/null +++ b/yaksh/migrations/0021_auto_20200703_1556.py @@ -0,0 +1,25 @@ +# Generated by Django 3.0.7 on 2020-07-03 10:26 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('yaksh', '0020_release_0_21_0'), + ] + + operations = [ + migrations.AlterField( + model_name='course', + name='end_enroll_time', + field=models.DateTimeField(default=datetime.datetime(2198, 12, 31, 18, 7, tzinfo=utc), null=True, verbose_name='End Date and Time for enrollment of course'), + ), + migrations.AlterField( + model_name='quiz', + name='end_date_time', + field=models.DateTimeField(default=datetime.datetime(2198, 12, 31, 18, 7, tzinfo=utc), null=True, verbose_name='End Date and Time of the quiz'), + ), + ] diff --git a/yaksh/migrations/0022_release_0_22_1.py b/yaksh/migrations/0022_release_0_22_1.py new file mode 100644 index 0000000..5275b86 --- /dev/null +++ b/yaksh/migrations/0022_release_0_22_1.py @@ -0,0 +1,30 @@ +# Generated by Django 3.0.7 on 2020-08-28 07:17 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('yaksh', '0021_auto_20200703_1556'), + ] + + operations = [ + migrations.AlterField( + model_name='course', + name='end_enroll_time', + field=models.DateTimeField(default=datetime.datetime(2199, 1, 1, 0, 0, tzinfo=utc), null=True, verbose_name='End Date and Time for enrollment of course'), + ), + migrations.AlterField( + model_name='questionpaper', + name='fixed_question_order', + field=models.TextField(blank=True), + ), + migrations.AlterField( + model_name='quiz', + name='end_date_time', + field=models.DateTimeField(default=datetime.datetime(2199, 1, 1, 0, 0, tzinfo=utc), null=True, verbose_name='End Date and Time of the quiz'), + ), + ] diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 6489b38..3f7e67e 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -239,21 +239,21 @@ question_type = "{{ question.type }}"; <!-- Integer type question --> {% if question.type == "integer" %} Enter Integer:<br/> - <input autofocus class="form-control" name="answer" type="number" id="integer" value="{{ last_attempt|safe }}" /> + <input autofocus class="form-control" name="answer" type="number" id="integer" value="{{ last_attempt|to_integer }}" /> <br><br> {% endif %} <!-- String type question --> {% if question.type == "string" %} Enter Text:<br/> - <textarea autofocus name="answer" id="string" class="form-control" style="width: 100%">{{ last_attempt|safe }}</textarea> + <textarea autofocus name="answer" id="string" class="form-control" style="width: 100%">{{ last_attempt|to_str }}</textarea> <br/><br/> {% endif %} <!-- Float type question --> {% if question.type == "float" %} Enter Decimal Value :<br/> - <input autofocus class="form-control" name="answer" type="number" step="any" id="float" value="{{ last_attempt|safe }}" /> + <input autofocus class="form-control" name="answer" type="number" step="any" id="float" value="{{ last_attempt|to_float }}" /> <br/><br/> {% endif %} diff --git a/yaksh/templatetags/custom_filters.py b/yaksh/templatetags/custom_filters.py index 7a065eb..cdbf4d0 100644 --- a/yaksh/templatetags/custom_filters.py +++ b/yaksh/templatetags/custom_filters.py @@ -122,3 +122,26 @@ def highlight_spaces(text): return text.replace( " ", '<span style="background-color:#ffb6db"> </span>' ) + + +@register.filter(name="to_integer") +def to_integer(text): + try: + value = int(text) + except ValueError: + value = '' + return value + + +@register.filter(name="to_float") +def to_float(text): + try: + value = float(text) + except ValueError: + value = '' + return value + + +@register.filter(name="to_str") +def to_str(text): + return text.decode("utf-8") |