help="Anonymize the data in the database in order to use them on critical servers (dev, personnal...). Every information will be overwritten using non-personnal informations. This script must follow any modification of the database."
defhandle(self,*args,**kwargs):
total=User.objects.count()
self.stdout.write("Starting anonymizing the {} users data.".format(total))
u=User.objects.all()
a=Adherent.objects.all()
self.stdout.write('Supression de l\'école...')
# Create a fake School to put everyone in it.
ecole=School(name="Ecole des Ninja")
ecole.save()
u.update(school=ecole)
self.stdout.write(self.style.SUCCESS('done ...'))
self.stdout.write('Supression des chambres...')
a.update(room=None)
self.stdout.write(self.style.SUCCESS('done ...'))
self.stdout.write('Supression des mails...')
u.update(email='example@example.org',
local_email_redirect=False,
local_email_enabled=False)
self.stdout.write(self.style.SUCCESS('done ...'))
self.stdout.write('Supression des noms, prenoms, pseudo, telephone, commentaire...')