from django.core.management.base import BaseCommand from accounts.tasks import deactivate_expired_users_task class Command(BaseCommand): help = 'Deactivate users whose active period has expired.' def handle(self, *args, **options): updated_count = deactivate_expired_users_task() self.stdout.write(self.style.SUCCESS(f'Deactivated {updated_count} expired user(s).'))