You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
553 B
15 lines
553 B
from datetime import timedelta, datetime
|
|
from emencia.django.newsletter.settings import REMOVE_INACTIVATED_CONTACTS_DAYS
|
|
from django.core.management.base import NoArgsCommand
|
|
from emencia.django.newsletter.models import Contact
|
|
|
|
|
|
class Command(NoArgsCommand):
|
|
"""
|
|
remove not activated contacts
|
|
"""
|
|
help = 'create the announce every week.'
|
|
|
|
def handle(self, *args, **options):
|
|
d = datetime.now() - timedelta(days=REMOVE_INACTIVATED_CONTACTS_DAYS)
|
|
Contact.objects.filter(activated=False, creation_date__lte=d).delete()
|
|
|