Skip to content

Commit

Permalink
Merge branch 'patch-648-skip-checks-command-argument-conflict'
Browse files Browse the repository at this point in the history
  • Loading branch information
goodtune committed Nov 10, 2021
2 parents d3a95ad + 711dda0 commit f4c508a
Show file tree
Hide file tree
Showing 4 changed files with 11 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'
1 change: 1 addition & 0 deletions tenant_schemas/management/commands/migrate_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


class Command(SyncCommon):
requires_system_checks = []
help = (
"Updates database schema. Manages both apps with migrations and those without."
)
Expand Down
1 change: 1 addition & 0 deletions tenant_schemas/management/commands/tenant_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


class Command(InteractiveTenantOption, BaseCommand):
requires_system_checks = []
help = "Wrapper around django commands for use with an individual tenant"

def handle(self, command, schema_name, *args, **options):
Expand Down

0 comments on commit f4c508a

Please sign in to comment.