Skip to content

Commit

Permalink
fix collectstatic_schemas command --skip-checs conflict issue and ten…
Browse files Browse the repository at this point in the history
…ant specific arguments forwarded to collectstatic
  • Loading branch information
danh91 authored and goodtune committed Nov 10, 2021
1 parent 44a95be commit dfbdbd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tenant_schemas/management/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,28 @@ def handle(self, *args, **options):
"""
Iterates a command over all registered schemata.
"""
arguments = ["schema_name", "skip_public"]
if options["schema_name"]:
# only run on a particular schema
connection.set_schema_to_public()
self.execute_command(
get_tenant_model().objects.get(schema_name=options["schema_name"]),
self.COMMAND_NAME,
*args,
**options
**{k: v for k, v in options.items() if k not in arguments}
)
else:
for tenant in get_tenant_model().objects.all():
if not (
options["skip_public"]
and tenant.schema_name == get_public_schema_name()
):
self.execute_command(tenant, self.COMMAND_NAME, *args, **options)
self.execute_command(
tenant,
self.COMMAND_NAME,
*args,
**{k: v for k, v in options.items() if k not in arguments}
)


class InteractiveTenantOption(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@


class Command(BaseTenantCommand):
requires_system_checks = []
COMMAND_NAME = 'collectstatic'

0 comments on commit dfbdbd3

Please sign in to comment.