No project description provided
Project description
Django-Cookiebanner
Installation
pip install django-cookiebanner
Usage
-
Add
cookiebanner
to yourINSTALLED_APPS
-
in your settings (
settings.py
) specify the different Cookie Groups:
COOKIEBANNER = {
"title": "Cookie settings",
"header_text": "We are using cookies on this website. A few are essential, others are not.",
"footer_text": "Please accept our cookies",
"groups": [
{
"id": "essential",
"name": "Essential",
"description": "Essential cookies allow this page to work.",
"cookies": [
{
"pattern": "cookiebanner",
"description": "Meta cookie for the cookies that are set.",
},
{
"pattern": "csrftoken",
"description": "This cookie prevents Cross-Site-Request-Forgery attacks.",
},
{
"pattern": "sessionid",
"description": "This cookie is necessary to allow logging in, for example.",
},
],
},
{
"id": "analytics",
"name": "Analytics",
"optional": True,
"cookies": [
{
"pattern": "_pk_.*",
"description": "Matomo cookie for website analysis.",
},
],
},
],
}
- In your base template add the banner and the conditionals:
{% load cookiebanner %}
...
<body>
{% cookiebanner_modal %}
...
{% cookie_accepted 'analytics' as cookie_analytics %}
{% if cookie_analytics %}
<script>... javascript for matomo ...</script>
{% endif %}
</body>
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
Built Distribution
Close
Hashes for django-cookiebanner-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dec883c7b697a156afa7017aaf890da1cf817ab32ef53d031adc405d8d4b9e4 |
|
MD5 | 9e7b4d406daa54b88873af7f43d0e40e |
|
BLAKE2b-256 | 09e48ee281b277a88949803d7875d1cd3209b89849843b943f70befef5b3005a |
Close
Hashes for django_cookiebanner-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d93f3be5213d27b974e4857e1d48f33a81e1b16c9dfd05c1e2e5d8e15e1f4a48 |
|
MD5 | d22e22927d88a7105c8a897a32912b08 |
|
BLAKE2b-256 | 19fef8e84f2d0f629662a00caf0becb0c8bb1b570d3c279d23e5cfc378d739d6 |