diff options
Diffstat (limited to 'ctrack/core/management')
-rw-r--r-- | ctrack/core/management/__init__.py | 0 | ||||
-rw-r--r-- | ctrack/core/management/commands/__init__.py | 0 | ||||
-rw-r--r-- | ctrack/core/management/commands/populate_db.py | 24 |
3 files changed, 24 insertions, 0 deletions
diff --git a/ctrack/core/management/__init__.py b/ctrack/core/management/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ctrack/core/management/__init__.py diff --git a/ctrack/core/management/commands/__init__.py b/ctrack/core/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ctrack/core/management/commands/__init__.py diff --git a/ctrack/core/management/commands/populate_db.py b/ctrack/core/management/commands/populate_db.py new file mode 100644 index 0000000..5b8f541 --- /dev/null +++ b/ctrack/core/management/commands/populate_db.py @@ -0,0 +1,24 @@ + +from django.core.management import BaseCommand +from django.core.management import CommandParser +from ctrack.core.utils import populate_db + + +class Command(BaseCommand): + help = """ + Creates a large test fixture. + """ + + def add_arguments(self, parser: CommandParser) -> None: + parser.add_argument("number", nargs=1, type=int) + + def handle(self, *args, **options): + number = options["number"][0] + populate_db(number) + + # TODO - adapt this so that it records more than just Persons created + self.stdout.write( + self.style.SUCCESS( + f"Created {number} Person object[s]! Go forth and multiply." + ) + ) |