From 081f99c569a4a7fedaaef6d5dced32c005a46bdb Mon Sep 17 00:00:00 2001 From: kovacspe Date: Sun, 14 Apr 2024 13:07:00 +0200 Subject: [PATCH] =?UTF-8?q?Prelo=C5=BEen=C3=A9=20hl=C3=A1=C5=A1ky=20do=20s?= =?UTF-8?q?loven=C4=8Diny=20(#375)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: vikibrezinova --- competition/views.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/competition/views.py b/competition/views.py index f169e2c..09bebb9 100644 --- a/competition/views.py +++ b/competition/views.py @@ -365,17 +365,17 @@ def upload_solutions_with_points(self, request, pk=None): """Nahrá .zip archív s opravenými riešeniami (pdf-kami).""" if 'file' not in request.data: - raise exceptions.ParseError(detail='No file attached') + raise exceptions.ParseError(detail='Žiaden súbor nebol pripojený') zfile = request.data['file'] if not zipfile.is_zipfile(zfile): raise exceptions.ParseError( - detail='Attached file is not a zip file') + detail='Priložený súbor nie je zip') with zipfile.ZipFile(zfile) as zfile: if zfile.testzip(): - raise exceptions.ParseError(detail='Zip file is corrupted') + raise exceptions.ParseError(detail='Súbor zip je poškodený') parsed_filenames = [] errors = [] @@ -394,20 +394,21 @@ def upload_solutions_with_points(self, request, pk=None): except (IndexError, ValueError, AssertionError): errors.append({ 'filename': filename, - 'status': 'Cannot parse file' + 'status': 'Nedá sa prečítať názov súboru. Skontroluj, že názov súboru' + 'je v tvare BODY-MENO-ID_ULOHY-ID_REGISTRACIE_USERA.pdf' }) continue except EventRegistration.DoesNotExist: errors.append({ 'filename': filename, - 'status': f'User registration with id {registration_pk} does not exist' + 'status': f'Registrácia používateľa s id {registration_pk} neexistuje' }) continue except Solution.DoesNotExist: errors.append({ 'filename': filename, - 'status': f'Solution with registration id {registration_pk}' - f'and problem id {problem_pk} does not exist' + 'status': f'Riešenie pre registráciu používateľa s id {registration_pk}' + f'a úlohy id {problem_pk} neexistuje' }) continue