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.3.tar.gz
(17.8 kB
view hashes)
Built Distribution
Close
Hashes for django-cookiebanner-0.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f1817ce55afc0026f7bbe1bad6782311752e5c55a4bece4195594be42730e7b |
|
MD5 | 53bf380285a25338e1a8c2c4b61cfc6e |
|
BLAKE2b-256 | 2f0b29d524cc6f73d79407ca25880d185bfd01e251eb72869bfec2819341c954 |
Close
Hashes for django_cookiebanner-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 751bebe387af37c548c74ff922069b4797e854316987d63103b8301ffbb0de85 |
|
MD5 | 6a45519bf2d3c3739e651a5cb3422dcf |
|
BLAKE2b-256 | 743cd393cfbf1634eea3d733eb405825836f0f08f6a29546008fad14dfb3fa24 |