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
Built Distribution
Close
Hashes for django-cookiebanner-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 632d6d058532209d0be907c216126579674113feeb147fcefd11d231f265fd58 |
|
MD5 | 9b1c73224f8dfec17209561b05514014 |
|
BLAKE2b-256 | 53cedd2989b7c405f834f7fe61acba59fea54509ac96e24ce85a46bfd2a7af1f |
Close
Hashes for django_cookiebanner-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb0c9ef21c9203aa6bd7080a927e96dcdcc5f94c0fe1124e5fa744d5f62c6c93 |
|
MD5 | 1082af15c0da463b3a956be57527ee8f |
|
BLAKE2b-256 | cbf5e5801fc128855a35dfd7fe1f21c1a411f27683a1789f13f9f5c27f6ea9d5 |