ferrosoft.apps.ferrobase.management.commands package

Submodules

ferrosoft.apps.ferrobase.management.commands.addtenant module

class ferrosoft.apps.ferrobase.management.commands.addtenant.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: BaseCommand

Management command that provisions a new tenant on the platform.

Creates the tenant record, sets up a dedicated PostgreSQL database, loads the requested fixtures, and optionally configures contact details. The organization must already exist in the master database.

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)[source]

The actual logic of the command. Subclasses must implement this method.

help = 'Add tenants to Ferrosoft Platform'

ferrosoft.apps.ferrobase.management.commands.deltenant module

class ferrosoft.apps.ferrobase.management.commands.deltenant.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: BaseCommand

Management command that removes one or more tenants from the platform.

Without --force, only the tenant record is deleted and the SQL commands to drop the database and role are printed for manual review. With --force, the database and PostgreSQL role are also dropped immediately.

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)[source]

The actual logic of the command. Subclasses must implement this method.

help = 'Delete tenants from Ferrosoft Platform'

ferrosoft.apps.ferrobase.management.commands.dumpdata_tenant module

class ferrosoft.apps.ferrobase.management.commands.dumpdata_tenant.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: BaseCommand

Management command that dumps fixture data from a tenant database.

Thin wrapper around Django’s dumpdata that activates the specified tenant database connection before delegating to the built-in command. The --tenant argument is required.

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)[source]

The actual logic of the command. Subclasses must implement this method.

ferrosoft.apps.ferrobase.management.commands.ferrobase_cleanup module

class ferrosoft.apps.ferrobase.management.commands.ferrobase_cleanup.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: BaseCommand

Management command that removes stale resources from all databases.

Runs CleanupService against the master database first, then against every active tenant database in alphabetical order.

handle(*args, **options)[source]

The actual logic of the command. Subclasses must implement this method.

help = 'Clean up old resources.'

ferrosoft.apps.ferrobase.management.commands.ferrobase_update module

class ferrosoft.apps.ferrobase.management.commands.ferrobase_update.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: BaseCommand

Management command that synchronises database resources with the current release.

Invokes Updater.run which upserts built-in data (countries, languages, measurement units, subscription plans, etc.) into the master database. Progress and errors are reported through CommandStatusWriter.

handle(*args, **options)[source]

The actual logic of the command. Subclasses must implement this method.

help = 'Update database resources with data from current release.'
class ferrosoft.apps.ferrobase.management.commands.ferrobase_update.CommandStatusWriter(output, style)[source]

Bases: StatusWriter

Bridges Updater status callbacks to Django management command output.

Maps StatusWriter severity levels (error, notice, success) to the corresponding Django OutputWrapper style methods so that messages are coloured consistently with other management output.

error(message)[source]

Report an error encountered by an updater.

notice(message)[source]

Report informational progress from an updater.

success(message)[source]

Report a successful updater step.

ferrosoft.apps.ferrobase.management.commands.listtenants module

class ferrosoft.apps.ferrobase.management.commands.listtenants.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: BaseCommand

Management command that lists tenants with their database sizes.

Outputs a tabulated view of tenant ID, name, active status, and the pretty-printed PostgreSQL database size. Pass --all to include inactive tenants.

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)[source]

The actual logic of the command. Subclasses must implement this method.

ferrosoft.apps.ferrobase.management.commands.loaddata_tenant module

class ferrosoft.apps.ferrobase.management.commands.loaddata_tenant.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: TenantAwareCommand

Management command that loads fixtures into a tenant database.

Wraps Django’s loaddata with tenant context activation and runs the import inside an atomic transaction so a partial fixture failure does not leave the database in an inconsistent state.

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

handle_tenant(*args, **options)[source]

Execute command logic for the active tenant context.

Called by handle after activating the tenant database connection. self.tenant holds the active Tenant instance (or None when running against the master database).

Parameters:
  • *args – Positional arguments forwarded from the CLI parser.

  • **options – Keyword arguments forwarded from the CLI parser.

ferrosoft.apps.ferrobase.management.commands.migratetenants module

class ferrosoft.apps.ferrobase.management.commands.migratetenants.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: BaseCommand

Management command that runs Django migrations for every active tenant.

Iterates over active tenants in alphabetical order, activates each tenant’s database connection, and calls migrate. Accepts optional app_label and migration_name arguments that are forwarded verbatim to migrate, allowing targeted migration or rollback for all tenants.

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)[source]

The actual logic of the command. Subclasses must implement this method.