anonymize_db.py
452 Bytes
#-*- coding:utf-8 -*-
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
class Command(BaseCommand):
args = 'none'
def handle(self, **options):
anonymize()
def anonymize():
user_id = 1
for user in User.objects.all():
if user.username != 'bniton':
user.username = 'user%d' % user_id
user.email = ''
user.save()
user_id += 1