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_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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd7021c8cd8e14b48e5df545a836e497aaa2d0cc009316556c1ff8b74ae366af |
|
MD5 | dec6255944cbe4c3d5b3de65de8b6e76 |
|
BLAKE2b-256 | 0421123b66282686b7c0150dcff5435546ef9342ab0adcff80c16d413efb9108 |
Close
Hashes for django_cookiebanner-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 515fb03d1295893f3db84af725a8dbe4d31578d6e84f4bc342549d6a38021056 |
|
MD5 | 27cfaa186cea232b1fb7337494ac1e6b |
|
BLAKE2b-256 | 784ebb5aa5ad48bacb1437cf7d70f4b274bab81cb7cb124ef63561155576791d |