Skip to main content

Django app to obfuscate text data.

Project description Documentation Status Updates

Django app to obfuscate text data. Originally develop by Dipcode Software.


Tested with python 3.6, 3.7, 3.8 and Django 1.11 & 2.2: Travis CI

How to install

To install the app run:

$ pip install django-db-obfuscater

or add it to the list of requirements of your project.

Then add ‘obfuscator’ to your INSTALLED_APPS.


Example usage

On you django project settings, configure the model names and field names to be obfuscated:

    'FIELDS': {
        'app_label.ModelClass1': ['field1', 'field2', 'field3'],
        'app_label.ModelClass2': ['field1'],
        // ...

Run the management command to start obfuscation:

$ python obfuscate

You can run the management command passing as arguments: a model class path and a list of fields to obfuscate (thus will ignore FIELDS setting):

$ python obfuscate --model=app_label.ModelClass1 --fields=field1, field2, field3

Settings reference


Default: obfuscator.utils.ObfuscatorUtils

Path to class where obfuscator methods are defined. By default, the class define tow obfuscator methods: * text - Obfuscate simple text data, respecting max-length field parameter; * email - Obfuscate email data. Only text before @ is obfuscated, respecting max-length field parameter.

This class also define an obfuscate method. This method use fields mapping (see FIELDS_MAPPING setting) to route the field type with the obfuscate method.

You can redefine this class by subclassing the default class and changing this setting to point to your class.



        models.CharField: 'text',
        models.TextField: 'text',
        models.EmailField: 'email',
        models.IntegerField: 'number',
        models.URLField: 'text',
        // ...

Map django model field types with obfuscator methods.


Default: {}

Fields to be obfuscated and respective model class path. Must be a dict with keys as python dot notation to path where the models are declared and the values must be declared as lists of model fields.

If no value defined, the management command will do nothing.


    'FIELDS': {
        'contenttypes.ContentType': ['model', 'label'],
        // ...


MIT license, see the LICENSE file. You can use obfuscator in open source projects and commercial products.


  • add logic to handle superusers, if needed

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-db-obfuscator, version 0.5.3
Filename, size File type Python version Upload date Hashes
Filename, size django_db_obfuscator-0.5.3-py2.py3-none-any.whl (10.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-db-obfuscator-0.5.3.tar.gz (12.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page