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_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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ea48a497c733cb91782fd18ae04d16391949fb047734b14204d0891a3a4a5ba |
|
MD5 | 9b960cfa88e3b9130810cc23fa18dee8 |
|
BLAKE2b-256 | c1cbdff0025be0dc7d76856811cab288f051005b12e0e570da837976125f5618 |
Close
Hashes for django_cookiebanner-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f49b944b5aecc86be1b0d4393714570d7712b3d5983abb0a53c5aa35ef2d24e |
|
MD5 | 126f2cc647f930362633436a1eefe82c |
|
BLAKE2b-256 | 8ed56c47ca44e687447507642f5e2a62df1d7080b0ecfd8a7134aeee429868b8 |