1. pombredanne
  2. django-anonymizer2


django-anonymizer2 / docs / djangofaker.rst

DjangoFaker - Django-aware fake data

This class is used by the :mod:`anonymizer.replacers` module to generate fake data. It encapsulates some knowledge about Django models and fields to attempt to generate data that fits the constraints of the model.

The remaining public methods all generate different types of fake data, using get_allowed_value to apply constraints. Many methods use an underlying faker.Faker instance. These include the following, which have some useful properties.

These name-related methods have the property that the same underlying first name and last name will be used until you repeat any of the methods. This means that if you use these methods to generate a set of data for a user model, the name/username/email address for a single object will correspond to each other.

For models with unique constraints on one of these fields, there is the complication that django-anonymizer will avoid setting unique fields to already present or already generated values. Sometimes this means that a fake data source must be used more than once to get a unique value, and this can upset the state of the cycle. To avoid this, put fields with a unique constraint at the start of the :attr:`~anonymizer.base.Anonymizer.attributes` list.