snapshot: preserve trial lifecycle and product-grade expiry UX

This commit is contained in:
Md Bayazid Bostame
2026-03-26 14:43:10 +01:00
parent 8821a7943b
commit 811bcd8745
24 changed files with 1196 additions and 148 deletions

View File

@@ -0,0 +1,23 @@
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import gettext as _
from workflows.trial import cleanup_trial_workspace_data, trial_cleanup_is_due
class Command(BaseCommand):
help = 'Deletes operational trial data after trial expiry while keeping platform configuration.'
def add_arguments(self, parser):
parser.add_argument('--force', action='store_true', help='Run cleanup even if the trial is not due yet.')
parser.add_argument('--yes-delete', action='store_true', help='Confirm destructive cleanup.')
def handle(self, *args, **options):
if not options['yes_delete']:
raise CommandError(_('Bitte mit --yes-delete bestätigen.'))
if not options['force'] and not trial_cleanup_is_due():
raise CommandError(_('Kein abgelaufener Trial mit aktiviertem Cleanup gefunden.'))
result = cleanup_trial_workspace_data()
self.stdout.write(self.style.SUCCESS(_('Trial-Workspace bereinigt.')))
for key, value in result.items():
self.stdout.write(f'- {key}: {value}')