django_pgschemas.utils.get_tenant_model(require_ready: bool = True) → Optional[django.db.models.base.Model]

Returns the tenant model.

django_pgschemas.utils.get_domain_model(require_ready: bool = True) → Optional[django.db.models.base.Model]

Returns the domain model.

django_pgschemas.utils.is_valid_identifier(identifier: str) → bool

Checks the validity of identifier.

django_pgschemas.utils.is_valid_schema_name(name: str) → bool

Checks the validity of a schema name.

django_pgschemas.utils.check_schema_name(name: str)

Checks schema name and raises ValidationError if name is not a valid identifier.

django_pgschemas.utils.remove_www(hostname: str) → str

Removes www. from the beginning of the address. Only for routing purposes. and should find the same tenant.


Decorator that makes decorated function to be run in the public schema.

django_pgschemas.utils.schema_exists(schema_name: str) → bool

Checks if a schema exists in database.

django_pgschemas.utils.create_or_clone_schema(schema_name: str, sync_schema: bool = True, verbosity: int = 1) → bool

Creates the schema schema_name. Optionally checks if the schema already exists before creating it. Returns True if the schema was created, False otherwise.


django_pgschemas.signals.schema_activate = <django.dispatch.dispatcher.Signal object>

Sent after a schema has been activated

django_pgschemas.signals.dynamic_tenant_needs_sync = <django.dispatch.dispatcher.Signal object>

Sent when a schema from a dynamic tenant needs to be synced

django_pgschemas.signals.dynamic_tenant_post_sync = <django.dispatch.dispatcher.Signal object>

Sent after a tenant has been saved, its schema created and synced

django_pgschemas.signals.dynamic_tenant_pre_drop = <django.dispatch.dispatcher.Signal object>

Sent when a schema from a dynamic tenant is about to be dropped

URL resolvers


Returns the proper URLConf depending on the schema. The schema must come with domain_url and folder members set.