Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions common/apps/organization/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ def get_new_organization_handler():
return None


def get_delete_organization_handler():
handler_path = getattr(settings, "DELETE_ORGANIZATION_HANDLER", None)
if handler_path is not None:
return import_string(handler_path)
return None


@task(name="spacedf.tasks.new_organization", max_retries=3)
@transaction.atomic
def create_organization(id, name, slug_name, is_active, owner, created_at, updated_at):
Expand Down Expand Up @@ -51,3 +44,11 @@ def create_organization(id, name, slug_name, is_active, owner, created_at, updat

if NewOrganizationHandler is not None:
NewOrganizationHandler(organization, owner).handle()


@task(name="spacedf.tasks.delete_organization", max_retries=3)
@transaction.atomic
def delete_organization(slug_name):
logger.info(f"delete_organization({slug_name})")
organization = Organization.objects.get(schema_name=slug_name)
organization.delete(force_drop=True)