for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
# -*- coding: utf-8 -*-
from django.db import transaction
Delete user across DB schemas.
if hasattr(user, 'tenant_set'):
from django_tenants.utils import schema_context # pylint: disable=import-error
# using transactions b/c multiple schemas can refer to the same
# user ID as FK references!
# delete user and all of its data across tenants
for tenant in user.tenant_set.all():
# then delete everything from the public schema