Package: leukeleu-django-gdpr
leukeleu-django-gdprInstallationpip install leukeleu-django-gdprAdd to INSTALLED_APPS:INSTALLED_APPS=[# ...'leukeleu_django_gdpr',# ...]ConfigurationBy default, thegdprmanagement command will writegdpr.ymltosettings.BASE_DIR.To change the output directory (without changingsettings.BASE_DIR) addDJANGO_GDPR_YML_DIRto your settings:DJANGO_GDPR_YML_DIR=os.path.join(BASE_DIR,'docs')Usage:On first run, leukeleu-django-gdpr will generate agdpr.ymlfile with amodelslist. This is
a list of models in your project, each containing a list of fields../manage.py gdprA filegdpr.ymlis created in the project root directory. It should be added to
version control. Each model in the models list has the following structure:models:auth.User:name:Userfields:username:name:Usernamedescription:String (up to %(max_length)s)help_text:Required. 150 characters or fewer. Letters, digits and @/./+/-/_only.required:truepii:nullfirst_name:name:First Namedescription:String (up to %(max_length)s)help_text:''required:falsepii:nullLeukeleu-django-gdpr adds thepii: nullto all fields. The objective is to replace all thosenullvalues with the correct boolean value;pii: trueif the field represents PII
data,pii: falseotherwise.When run again, leukeleu-django-gdpr will persist those values, allowing you to work your way to
eliminating allpii: nulls.Leukeleu-django-gdpr outputs counts of thepii:values when run:./manage.py gdpr
Checking...
No PII set     48
PII True       1
PII False      0Run with--checkto make the command exit with exit code 1 if 'No PII set' > 0 (the
yaml file will still be generated/updated).You can prevent leukeleu-django-gdpr from writing (back) to the yaml file by running with the--dry-runflag.Excluding/includingTo exclude apps, models or fields from this process altogether, list them in theexclude:list in the yaml file. Each item is a regex which should match an object's
string representation in the following formats;for apps: the app'slabel, e.g.auth.for models: the model's label, e.g.auth.Permissionfor fields: the model's label followed by.followed by the field's name, e.g.auth.User.username.Keep in mind that the items in the list are considered to be regexes which shouldfullymatch the object's string representation.Default excludesBy default, leukeleu-django-gdpr excludes fields of the following types:AutoFieldUUIDFieldBooleanFieldRelatedFieldand the following apps:django.contrib.admindjango.contrib.contenttypesIf you still want to include a field/model that would be excluded this way, you can put
an item in theinclude:list in the yaml file:include:
- clients\.Client\.external_epd_uuid
- accounts\.Profile\.is_pregnant
- admin\.LogEntryProxy models are always excluded. They are the same as the model they proxy,
so there is no benefit in including them.ChecksLeukeleu-django-gdpr adds agdpr.I001check to thecheckcommand. This check will fail if
there are anypii: nullvalues in the yaml file. To run the check, run:./manage.py checkCI/CDTo run this in CI/CD you need to ensure this package can be installed from
wherever this package is indexed. Run it with--checkto make a (scheduled?) CI/CD task
fail if there are unclassified fields, which can happen if someone adds a field to a model
but forgets to mark it as (non-) PII in the gdpr.yml.