mgmt command for importing episode actions from file
[mygpo.git] / mygpo / maintenance / management / commands / cleanup-unused-users.py
blobad04d8fcea467db9310799c9d788c90efcf76f4d
1 from django.core.management.base import BaseCommand
3 from mygpo.utils import progress
4 from mygpo.db.couchdb.user import deleted_users, deleted_user_count
7 class Command(BaseCommand):
9 def handle(self, *args, **options):
11 users = deleted_users()
12 total = deleted_user_count()
14 for n, user in enumerate(users):
16 if user.is_active or not user.deleted:
17 print 'skipping', user.username
19 print 'deleting', user.username,
20 user.delete()
22 progress(n+1, total)