Fix photo authorization export

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-10-28 23:48:25 +01:00
parent a5aff5ff21
commit 20410cc17f
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
3 changed files with 7 additions and 3 deletions

View File

@ -103,7 +103,7 @@ le 2 mars à 22h :
.. code:: python .. code:: python
REGISTRATION_DATES = dict( REGISTRATION_DATES = dict(
open=datetime.fromisoformat("2025-01-08T12:00:00+0100"), open=datetime.fromisoformat("2025-01-15T12:00:00+0100"),
close=datetime.fromisoformat("2025-03-02T22:00:00+0100"), close=datetime.fromisoformat("2025-03-02T22:00:00+0100"),
) )

View File

@ -12,6 +12,8 @@ class Command(BaseCommand):
def handle(self, *args, **kwargs): def handle(self, *args, **kwargs):
base_dir = Path(__file__).parent.parent.parent.parent base_dir = Path(__file__).parent.parent.parent.parent
base_dir /= "output" base_dir /= "output"
if not base_dir.is_dir():
base_dir.mkdir()
base_dir /= "solutions" base_dir /= "solutions"
if not base_dir.is_dir(): if not base_dir.is_dir():
base_dir.mkdir() base_dir.mkdir()

View File

@ -14,7 +14,9 @@ class Command(BaseCommand):
def handle(self, *args, **kwargs): def handle(self, *args, **kwargs):
base_dir = Path(__file__).parent.parent.parent.parent base_dir = Path(__file__).parent.parent.parent.parent
base_dir /= "output" base_dir /= "output"
base_dir / "photo_authorizations" if not base_dir.is_dir():
base_dir.mkdir()
base_dir /= "photo_authorizations"
if not base_dir.is_dir(): if not base_dir.is_dir():
base_dir.mkdir() base_dir.mkdir()
@ -30,6 +32,6 @@ class Command(BaseCommand):
file_output.write(file_input.read()) file_output.write(file_input.read())
if participant.photo_authorization_final: if participant.photo_authorization_final:
with participant.photo_authorization.file as file_input: with participant.photo_authorization_final.file as file_input:
with open(team_dir / f"{participant} (finale).pdf", 'wb') as file_output: with open(team_dir / f"{participant} (finale).pdf", 'wb') as file_output:
file_output.write(file_input.read()) file_output.write(file_input.read())