text: Source
  django-anonymizer / README.rst
  Django Anonymizer
  This app aims to help you anonymize data in a database used for development.
  It is common practice in develpment to use a database that is very similar in content to the real data. The problem is that this can lead to have copies of sensitive customer data on development machines (and backups etc). This Django app helps by giving an easy and customizable way to anonymize data in your models.
  The basic method is go through all the models that you specify, and generate fake data for all the fields specified. Introspection of the models will produce an anonymizer that will attempt to provide sensible fake data for each field, leaving you to fill in the gaps.
  Please note that the methods provided will not provide'.
  Usage:
  Install using setup.py or pip/easy_install.
  Add 'anonymizer' to your INSTALLED_APPS setting.
  To create some stub files for your anonymizers, do:
  ., filling out the details, and adding any filtering. You can override any of the public methods defined in anonymizer.base.Anonymizer in order to do filtering and other customization.
  The 'attributes' dictionary is the key attribute to edit. The keys are the attribute names of attributes on the model that need to be set. The values are either strings (as a shortcut, see below), or callables that take the following arguments:
  - The Anonymizer instance
  - The object being edited.
  - The field being edited
  - The current value of the field.
  The Anonymizer instance has an attribute 'faker' attribute which is useful for generating faked data.
  If the value is a string, e.g. 'email', it is turned into a lambda as follows:
  lambda self, obj, field, val: self.faker.email(field=field)
  For some fields, you will want to remove them from the list of attributes, so that the values will be unchanged - especially things like denormalised fields. You may need to override the 'alter_object' to fix up any fields like that.
  An example Anonymizer for django.contrib.auth.models.User might look like this:
  from datetime import datetime from anonymizer import Anonymizer from django.contrib.auth.models import User class UserAnonymizer(Anonymizer): model = User attributes = { 'username': 'username', 'first_name': 'first_name', 'last_name': 'last_name', 'email': 'email', # Set the date_joined to a similar time to when they actually # joined, by passing the 'val' parameter to faker.datetime 'date_joined': lambda self, obj, field, val: self.faker.datetime(field=field, val=val), # Set to today: 'last_login': lambda *args: datetime.now() } def alter_object(self, obj): if obj.is_superuser: return False # don't change, so we can still log in. super(UserAnonymizer, self).alter_object(obj) # Destroy all passwords for everyone else obj.set_unusable_password() run the anonymizers, do:
  ./manage.py anonymize_data app_name1 [app_name2...]
  This will DESTRUCTIVELY UPDATE all your data. Make sure you have backups, use at own risk, yada yada.