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:
from django.utils.translation import ugettext_lazy as _
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": _("Imprint"),
"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
django-cookiebanner-0.2.4.tar.gz
(18.0 kB
view hashes)
Built Distribution
Close
Hashes for django-cookiebanner-0.2.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 195f4da337d252cab3bd08b4e49f0b0bfcf73782e621e47736f366217e4ff092 |
|
MD5 | f06d444eb2c78a23630bcc3951e955e9 |
|
BLAKE2b-256 | 199597e0dae71860c51db53435856a35d28b9156bbff75b88995adcadd534158 |
Close
Hashes for django_cookiebanner-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c26b5780f9f796b46364415d40d498f303b1b2e7d93a64164970be478265cd5 |
|
MD5 | 15388539a0d7e390583a2ce6ff42e0f7 |
|
BLAKE2b-256 | 6c39fb64f338090684b77b080b4ffa18fb06d5925b0cfb22cf3eabd5eae39190 |