From 92a8ddf805c6f2431aca1f995a61de743f3adca8 Mon Sep 17 00:00:00 2001 From: CapooL <2053217188@qq.com> Date: Thu, 30 Nov 2023 16:00:26 +0800 Subject: [PATCH] style(quiz): reformat for black --- .../quiz/migrations/0005_paper_record.py | 38 +++++++++++++++---- .../quiz/paper/view/paper_record_single.py | 3 -- hinghwa-dict-backend/quiz/urls.py | 1 - .../utils/exception/types/not_found.py | 2 +- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/hinghwa-dict-backend/quiz/migrations/0005_paper_record.py b/hinghwa-dict-backend/quiz/migrations/0005_paper_record.py index c1734041..75260d92 100644 --- a/hinghwa-dict-backend/quiz/migrations/0005_paper_record.py +++ b/hinghwa-dict-backend/quiz/migrations/0005_paper_record.py @@ -4,20 +4,44 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('quiz', '0004_quiz_paper'), + ("quiz", "0004_quiz_paper"), ] operations = [ migrations.CreateModel( - name='PaperRecord', + name="PaperRecord", fields=[ - ('timestamp', models.DateTimeField(verbose_name='时间')), - ('id', models.CharField(max_length=20, primary_key=True, serialize=False, verbose_name='ID')), - ('examine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='paper_user', to=settings.AUTH_USER_MODEL, verbose_name='答卷人')), - ('paper', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='papers', to='quiz.paper', verbose_name='试卷')), + ("timestamp", models.DateTimeField(verbose_name="时间")), + ( + "id", + models.CharField( + max_length=20, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "examine", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="paper_user", + to=settings.AUTH_USER_MODEL, + verbose_name="答卷人", + ), + ), + ( + "paper", + models.ForeignKey( + blank=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="papers", + to="quiz.paper", + verbose_name="试卷", + ), + ), ], ), ] diff --git a/hinghwa-dict-backend/quiz/paper/view/paper_record_single.py b/hinghwa-dict-backend/quiz/paper/view/paper_record_single.py index cd3dee53..25a6f448 100644 --- a/hinghwa-dict-backend/quiz/paper/view/paper_record_single.py +++ b/hinghwa-dict-backend/quiz/paper/view/paper_record_single.py @@ -16,6 +16,3 @@ def get(self, request, record_id): user_id = record.examine.id token_pass(request.headers, user_id) return JsonResponse(paper_record_all(record), status=200) - - - diff --git a/hinghwa-dict-backend/quiz/urls.py b/hinghwa-dict-backend/quiz/urls.py index ebd4bcd3..6614c3c0 100644 --- a/hinghwa-dict-backend/quiz/urls.py +++ b/hinghwa-dict-backend/quiz/urls.py @@ -16,5 +16,4 @@ path("/paper/records", csrf_exempt(PaperRecordAll.as_view())), path("/paper/records/", csrf_exempt(PaperRecordSingle.as_view())), path("/paper/", csrf_exempt(ManageSinglePaper.as_view())), - ] diff --git a/hinghwa-dict-backend/utils/exception/types/not_found.py b/hinghwa-dict-backend/utils/exception/types/not_found.py index 9dc59e35..33e931d9 100644 --- a/hinghwa-dict-backend/utils/exception/types/not_found.py +++ b/hinghwa-dict-backend/utils/exception/types/not_found.py @@ -209,4 +209,4 @@ class PaperRecordNotFoundException(NotFoundException): def __init__(self, id=""): super().__init__() self.status = 404 - self.msg = "答卷记录{}不存在!".format(id) \ No newline at end of file + self.msg = "答卷记录{}不存在!".format(id)