"""Adds a command to cleanup the expired registration attempts."""

from django.core.management.base import BaseCommand

from membership.models import ActivationRequest


class Command(BaseCommand):
    """Delete all expired user registrations from the database."""

    def handle(self, *args, **options):
        """Get all expired Activation Objects and call the delete() method."""
        for activation in ActivationRequest.objects.expired():
            activation.user.delete()
