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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53219f8f4695cad48ad1ebbc4b69e2e972010499fba55c5250da9f3048e8923f |
|
MD5 | fad7d7cb8d70159a5347b5ec2d22c3ed |
|
BLAKE2b-256 | e047a4533b5157a891e4769f311612e8791ea597724ed588e3f3135d8615545c |
Close
Hashes for django_cookiebanner-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cddd2cd30cc8890c76923e0b59221d20e1cafad2d245e5bfd03c3d1653d9da96 |
|
MD5 | 2e589c10a7aaa3430c4b1491b2a790e6 |
|
BLAKE2b-256 | a57f88cd4c020baec906e4c751ae0c41f5e6ccf07ddd6d1563fbcead3c5c03f3 |