Your project description goes here
Project description
django-cookie-monster
This package gives you two versions of a cookie banner. The simple one is basically just a hint to inform users that you are using cookies. The group version let's your users decide which cookies he needs.
Quickstart
Install django-cookie-monster::
pip install django-cookie-monster
Add it to your INSTALLED_APPS
:
INSTALLED_APPS = (
...
'cookie_monster',
...
)
Add a type and data property to all script tags that store any cookies.
<!-- before -->
<script>// This is my script</script>
<!-- after -->
<script type="text/plain" data-cookieconsent="the_ID_of_my_group">// This is my script</script>
Settings
Overwrite strings in your settings file. You will find a complete reference below.
COOKIE_MONSTER = {
'banner': {
'title': 'My Cookie Banner Title',
}
}
To switch from standard to group mode you need to specify a list of setting groups.
COOKIE_MONSTER = {
'cookie_groups': {
'rows': [
'Name',
'Provider',
'Purpose',
],
'groups': [
{
'title': 'Necessary',
'required': True,
'cookies': [
{
'id': 'application',
'rows': [
'Language',
'example.com',
'site language',
],
},
],
},
{
'title': 'Marketing',
'required': False,
'cookies': [
{
'id': 'GTM',
'rows': [
'Google Tag Manager',
'Google.com',
'tracking cookie',
],
},
],
},
],
},
}
This is an example of a fully customised version of a cookie banner:
COOKIE_MONSTER = {
'banner': {
'title': 'My Cookie Banner Title',
'text': 'This is my custom text with a dynamic <a href="https://example.com/">link</a> to another page.',
'policy_link': 'contents.utils.my_callable_that_returns_a_dynamic_link_to_the_privacy_page',
'buttons': {
'confirm': {'label': 'Accept all cookies'},
'toggle': {'label': 'Toggle settings'},
'accept_all_cookies': {'label': 'Accept all Cookies'},
'accept_all_group_cookies': {'label': 'Accept {groupTitle} Cookies'}
},
},
'accordion_title': '{groupTitle} ({amount})',
'custom_theme': True,
'cookie_groups': {
'rows': [
'Name',
'Provider',
'Purpose',
],
'groups': [
{
'title': 'Necessary',
'required': True,
'cookies': [
{
'id': 'application',
'rows': [
'Language',
'example.com',
'site language',
],
},
],
},
{
'title': 'Marketing',
'required': False,
'cookies': [
{
'id': 'GTM',
'rows': [
'Google Tag Manager',
'Google.com',
'tracking cookie',
],
},
],
},
],
},
}
Contribute
Installation
To install the frontend you will need to run:
npm i
Building frontend
The frontend can be built via:
npm run build
Unit test
You can unit test the frontend code with:
npm test
History
0.1.3 (2020-05-13) ++++++++++++++++++
- Fix translation issue in banner text
0.1.2 (2020-04-09) ++++++++++++++++++
- Bugfix
0.1.1 (2020-04-08) ++++++++++++++++++
- Bugfix
0.1.0 (2019-10-16) ++++++++++++++++++
- First release on PyPI.
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
Hashes for django-cookie-monster-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 308f65dccda89c606e690f8923996a4985ee1d7f29fa2515cb0667f0c241e7fc |
|
MD5 | 1864ebc7f487d239e62637945a12ef03 |
|
BLAKE2b-256 | eb6f8297366f1567cbdd47994119789f85bef3c875adc2e7120479b44a85ec00 |