diff options
Diffstat (limited to 'maintenance/management')
-rw-r--r-- | maintenance/management/__init__.py | 0 | ||||
-rw-r--r-- | maintenance/management/commands/__init__.py | 1 | ||||
-rw-r--r-- | maintenance/management/commands/log_generator.py | 20 |
3 files changed, 21 insertions, 0 deletions
diff --git a/maintenance/management/__init__.py b/maintenance/management/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/maintenance/management/__init__.py diff --git a/maintenance/management/commands/__init__.py b/maintenance/management/commands/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/maintenance/management/commands/__init__.py @@ -0,0 +1 @@ + diff --git a/maintenance/management/commands/log_generator.py b/maintenance/management/commands/log_generator.py new file mode 100644 index 0000000..95c03d0 --- /dev/null +++ b/maintenance/management/commands/log_generator.py @@ -0,0 +1,20 @@ +#Dev/KoDe :) + +import csv +import datetime +import os +import sys +from django.core.management.base import BaseCommand, CommandError + +class Command(BaseCommand): + args = '' + help = 'Creates Log' + + def handle(self, *args, **options): + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sbhs_server.settings") # To make a Django Environment. + + from sbhs_server.tables.models import Board + board_details = Board.objects.values_list("online", flat=True) + board = str([x for x in board_details]) + with open('new.csv', "a") as newcsv: + newcsv.write("{0} {1} \n".format(datetime.datetime.now(), board.replace(",", "").replace("[", "").replace("]",""))) |