From d5637a14024f720b837dfb33643e5ad8349e330a Mon Sep 17 00:00:00 2001 From: Ross Date: Tue, 9 Mar 2021 15:28:54 +0000 Subject: [PATCH] . --- .../0035_exam_json_creation_time.py | 18 +++++++++++++++ generic/models.py | 2 +- generic/views.py | 6 ++++- longs/migrations/0031_auto_20210309_1527.py | 23 +++++++++++++++++++ longs/models.py | 2 +- .../0004_exam_json_creation_time.py | 18 +++++++++++++++ .../0020_exam_json_creation_time.py | 18 +++++++++++++++ 7 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 anatomy/migrations/0035_exam_json_creation_time.py create mode 100644 longs/migrations/0031_auto_20210309_1527.py create mode 100644 physics/migrations/0004_exam_json_creation_time.py create mode 100644 rapids/migrations/0020_exam_json_creation_time.py diff --git a/anatomy/migrations/0035_exam_json_creation_time.py b/anatomy/migrations/0035_exam_json_creation_time.py new file mode 100644 index 00000000..2138b523 --- /dev/null +++ b/anatomy/migrations/0035_exam_json_creation_time.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-03-09 15:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('anatomy', '0034_auto_20210215_1200'), + ] + + operations = [ + migrations.AddField( + model_name='exam', + name='json_creation_time', + field=models.DateTimeField(blank=True, default=None, null=True), + ), + ] diff --git a/generic/models.py b/generic/models.py index 732c6352..95ffdb55 100644 --- a/generic/models.py +++ b/generic/models.py @@ -64,7 +64,7 @@ class ExamBase(models.Model): help_text="If the json cache needs updating", default=False ) - json_creation_time = models.DateTimeField(blank=True) + json_creation_time = models.DateTimeField(blank=True, default=None, null=True) #time_limit = models.IntegerField( # help_text="Exam time limit (in seconds). Default is 2100 secondse (35 minutes)", diff --git a/generic/views.py b/generic/views.py index e55e39a8..a91e4378 100644 --- a/generic/views.py +++ b/generic/views.py @@ -319,13 +319,17 @@ class ExamViews(View, LoginRequiredMixin): for exam in exams: if exam.active: + if exam.json_creation_time: + creation_time = exam.json_creation_time.isoformat() + else: + creation_time = "None" active_exams["exams"].append( { "name": exam.get_exam_name(), "url": request.build_absolute_uri(exam.get_json_url()), "type": self.question_type, "eid": "{}/{}".format(self.question_type, exam.pk), - "json_creation_time": exam.json_creation_time.isoformat() + "json_creation_time": creation_time } ) diff --git a/longs/migrations/0031_auto_20210309_1527.py b/longs/migrations/0031_auto_20210309_1527.py new file mode 100644 index 00000000..9542159f --- /dev/null +++ b/longs/migrations/0031_auto_20210309_1527.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.3 on 2021-03-09 15:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('longs', '0030_long_recreate_json'), + ] + + operations = [ + migrations.AddField( + model_name='exam', + name='json_creation_time', + field=models.DateTimeField(blank=True, default=None, null=True), + ), + migrations.AddField( + model_name='long', + name='json_creation_time', + field=models.DateTimeField(blank=True, default=None, null=True), + ), + ] diff --git a/longs/models.py b/longs/models.py index bb71b396..baf8edef 100644 --- a/longs/models.py +++ b/longs/models.py @@ -120,7 +120,7 @@ class Long(models.Model): help_text="If the json cache needs updating", default=False ) - json_creation_time = models.DateTimeField(blank=True) + json_creation_time = models.DateTimeField(blank=True, default=None, null=True) #question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True) diff --git a/physics/migrations/0004_exam_json_creation_time.py b/physics/migrations/0004_exam_json_creation_time.py new file mode 100644 index 00000000..72074042 --- /dev/null +++ b/physics/migrations/0004_exam_json_creation_time.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-03-09 15:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('physics', '0003_auto_20201228_2235'), + ] + + operations = [ + migrations.AddField( + model_name='exam', + name='json_creation_time', + field=models.DateTimeField(blank=True, default=None, null=True), + ), + ] diff --git a/rapids/migrations/0020_exam_json_creation_time.py b/rapids/migrations/0020_exam_json_creation_time.py new file mode 100644 index 00000000..e7bb2656 --- /dev/null +++ b/rapids/migrations/0020_exam_json_creation_time.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-03-09 15:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('rapids', '0019_auto_20210215_1203'), + ] + + operations = [ + migrations.AddField( + model_name='exam', + name='json_creation_time', + field=models.DateTimeField(blank=True, default=None, null=True), + ), + ]