|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#-*- 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
|