From 2098cd23821294c4a1bf85a3ab533bd15156fcee Mon Sep 17 00:00:00 2001 From: Cory Zue Date: Fri, 27 Feb 2026 09:42:41 +0200 Subject: [PATCH] Fix update_warehouse command to use --start-date and --end-date options The command was using *args to read positional arguments, but modern Django passes arguments via **options, so dates were always None. Switched to named options which also allows passing --end-date without --start-date. Co-Authored-By: Claude Opus 4.6 --- .../management/commands/update_warehouse.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ex-submodules/django-datawarehouse/warehouse/management/commands/update_warehouse.py b/ex-submodules/django-datawarehouse/warehouse/management/commands/update_warehouse.py index f0a7fef29..29c329074 100644 --- a/ex-submodules/django-datawarehouse/warehouse/management/commands/update_warehouse.py +++ b/ex-submodules/django-datawarehouse/warehouse/management/commands/update_warehouse.py @@ -7,10 +7,20 @@ class Command(BaseCommand): help = "Run the data warehouse" - args = " " - label = "" def add_arguments(self, parser): + parser.add_argument( + '--start-date', + dest='start_date', + help='Start date for the warehouse run', + default=None, + ) + parser.add_argument( + '--end-date', + dest='end_date', + help='End date for the warehouse run', + default=None, + ) parser.add_argument( '--cleanup', action='store_true', @@ -20,7 +30,7 @@ def add_arguments(self, parser): ) def handle(self, *args, **options): - start_date = None if len(args) < 1 else string_to_datetime(args[0]) - end_date = None if len(args) < 2 else string_to_datetime(args[1]) + start_date = string_to_datetime(options["start_date"]) if options["start_date"] else None + end_date = string_to_datetime(options["end_date"]) if options["end_date"] else None cleanup = options["cleanup"] return runner.update_warehouse(start_date, end_date, cleanup)