-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix export reservation units command
- Loading branch information
1 parent
f004f01
commit 03aae6c
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
8 changes: 6 additions & 2 deletions
8
tilavarauspalvelu/management/commands/export_reservation_units.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
from typing import Any | ||
|
||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
|
||
from tilavarauspalvelu.utils.reservation_units.export_data import ReservationUnitExporter | ||
from tilavarauspalvelu.services.csv_export import ReservationUnitExporter | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Exports reservation unit data from the database" | ||
|
||
def handle(self, *args: Any, **options: Any) -> None: | ||
ReservationUnitExporter.export_reservation_unit_data() | ||
string_io = ReservationUnitExporter().write() | ||
string_io.seek(0) | ||
Path(settings.BASE_DIR).write_bytes(string_io.getvalue().encode("utf-8")) |