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",
"footer_links": [
{ "title": "Impprint", "href": "/imprint"},
{ "title": "Privacy", "href": "/privacy"},
],
"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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ef8bfacf5f3d81cd401e71c15a05077e06d4ddf609b71ec094613e1ee1b57e1 |
|
MD5 | 40dde894caa46c7d5c4b324ba1232e35 |
|
BLAKE2b-256 | 4d1bba5078d64b65080907b7b5609c06ce5f6e0e998e09c38a08356536700dc1 |
Close
Hashes for django_cookiebanner-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc503a14804bf9660223997618dc33ba942ad54bf1222581a7ddc7355562dae0 |
|
MD5 | 044f64393493824a3ef63298028ac691 |
|
BLAKE2b-256 | da8666773ee7cb44360cd561212d6b31218752667146d41961bf27ef04103b2e |