Django application for handling privacy and cookie policies configured with Iubenda.
Project description
django-iubenda
GitHub
Test
Compliance for websites and apps
Click here and get 10% discount on first year at Iubenda
Check Demo Project
Requirements
- Python 3.7 to 3.10 supported.
- Django 3.2 to 4.0 supported.
Setup
- Install from pip:
pip install django-iubenda
- Modify
settings.py
by adding the app toINSTALLED_APPS
:
INSTALLED_APPS = (
"modeltranslation",
# ...
"iubenda",
# ...
)
- Modify
settings.py
by adding the app's context processor toTEMPLATES
:
TEMPLATES = [
{
# ...
'OPTIONS': {
'context_processors': [
# ...
'iubenda.context_processors.iubenda',
# ...
],
},
},
]
- Be sure the Django's Locale middleware is enabled inside
settings.py
:
MIDDLEWARE = (
# ...
'django.middleware.locale.LocaleMiddleware',
# ...
)
- Be sure the variable
LANGUAGE_CODE
is available for HTML templates:
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
- Modify your project's template to add privacy and cookie policies.
For example inside the
footer.html
add following code:
{% if not debug %}
{% block iubenda %}{% include "iubenda/include-content.html" %}{% endblock iubenda %}
{% endif %}
Optional
Content Security Policy
If Content Security Policy are implemented in your server and inline scripts are disabled,
the variable IUBENDA_CSP_NONCE
can be set with nonce tag will be inserted script's nonce.
<script type="text/javascript" {% if cx_iubenda_nonce %}nonce="{{ cx_iubenda_nonce }}"{% endif %}>
Iubenda's Options
To personalize the Iubenda script behaviour, the dict IUBENDA_OPTIONS
can be configured inside settings.py
IUBENDA_OPTIONS = {"ccpaAcknowledgeOnDisplay": "true",
"ccpaApplies": "true",
"consentOnContinuedBrowsing": "false",
"enableCcpa": "true",
"floatingPreferencesButtonDisplay": "bottom-left",
"invalidateConsentWithoutLog": "true",
"perPurposeConsent": "true",
"whitelabel": "false",
"banner": {
"acceptButtonDisplay": "true",
"backgroundOverlay": "true",
"closeButtonRejects": "true",
"customizeButtonDisplay": "true",
"explicitWithdrawal": "true",
"fontSize": "14px",
"listPurposes": "true",
"position": "float-center",
"rejectButtonDisplay": "true"
}
}
Run Example Project
git clone --depth=50 --branch=django-iubenda https://github.com/DLRSP/example.git DLRSP/example
cd DLRSP/example
python manage.py runserver
Now browser the app @ http://127.0.0.1:8000
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-iubenda-0.1.12.dev0.tar.gz
(43.8 kB
view hashes)
Built Distributions
Close
Hashes for django-iubenda-0.1.12.dev0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21e136847ec090b4f3247f1af3ded0c65fe176cf8238d33063f32e42dbd2db41 |
|
MD5 | d06acb482628b7d0b60175ab9d02a78f |
|
BLAKE2b-256 | a4c358f581ea833a7b5144ebd235da7b42c24a7392fdde24099ae53965f5246f |
Close
Hashes for django_iubenda-0.1.12.dev0-py3.10.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52736c6e5a1813f88c64b2fea7e02effcd2e2620441ac3f93b3161a0e269e9a5 |
|
MD5 | 8dfadc83eb7d7b4227c11ea8b0a20f74 |
|
BLAKE2b-256 | 81456038566a09726a326b3755d4d6e821ad78867ab2ae9b53b376fa5077b054 |
Close
Hashes for django_iubenda-0.1.12.dev0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bb27fa1c18b02deb7670c44fc441bcc80c73ee4018a410daae8632b4750e356 |
|
MD5 | 7b7c03eb0223dbf4b822ea06bf4ced92 |
|
BLAKE2b-256 | 7d099e0eb752338e2f6fb8ba6c1e30841fdb80dbfbc1f8b45f9ba67733bba0cc |