# django-cookie-monster
<img src="https://github.com/dreipol/django-cookie-monster/raw/develop/docs/cookie_monster.svg" width="250"/>
[![CircleCI](https://circleci.com/gh/dreipol/django-cookie-monster.svg?style=svg)](https://circleci.com/gh/dreipol/django-cookie-monster)
[![Maintainability](https://api.codeclimate.com/v1/badges/3032662f751343e49710/maintainability)](https://codeclimate.com/github/dreipol/django-cookie-monster/maintainability)
[![Coverage Status](https://coveralls.io/repos/github/dreipol/django-cookie-monster/badge.svg?branch=develop)](https://coveralls.io/github/dreipol/django-cookie-monster?branch=develop)
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.
```html
<!-- 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.
```python
COOKIE_MONSTER = {
'banner': {
'title': 'My Cookie Banner Title',
}
}
```
To switch from standard to group mode you need to specify a list of setting groups.
```python
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:
```python
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})',
'cookie': {
'samesite': 'Lax'
},
'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:
```sh
npm i
```
## Building frontend
The frontend can be built via:
```sh
npm run build
```
## Unit test
You can unit test the frontend code with:
```sh
npm test
```
History
-------
0.1.8.2 (2023-05-15)
++++++++++++++++++
* Simplify imports
0.1.8.1 (2023-04-20)
++++++++++++++++++
* Include *.map files in source distribution
0.1.8 (2023-02-02)
++++++++++++++++++
* Add Django 4 compatibility
0.1.7 (2022-10-11)
++++++++++++++++++
* Add samesite configuration option
0.1.6 (2022-01-31)
++++++++++++++++++
* Simplify banner text to prevent fails
DEPRECATION WARNING:
* The setting variable `policy_link` was removed due to errors. Please handle any text/link combinations yourself.
0.1.5 (2021-02-15)
++++++++++++++++++
* Add plain html support for the groups labels
0.1.4 (2020-05-13)
++++++++++++++++++
* Improve backward compatibility of browsers
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/victoriameyer/django-cookie-monster",
"name": "django-cookie-monster",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "django-cookie-monster",
"author": "dreipol GmbH",
"author_email": "dev@dreipol.ch",
"download_url": "https://files.pythonhosted.org/packages/c1/ea/73999a9a896893d24f004f59a596b56c4057ab4072d01f664a25bb615e33/django-cookie-monster-0.1.8.2.tar.gz",
"platform": null,
"description": "# django-cookie-monster\n<img src=\"https://github.com/dreipol/django-cookie-monster/raw/develop/docs/cookie_monster.svg\" width=\"250\"/>\n\n[![CircleCI](https://circleci.com/gh/dreipol/django-cookie-monster.svg?style=svg)](https://circleci.com/gh/dreipol/django-cookie-monster)\n[![Maintainability](https://api.codeclimate.com/v1/badges/3032662f751343e49710/maintainability)](https://codeclimate.com/github/dreipol/django-cookie-monster/maintainability)\n[![Coverage Status](https://coveralls.io/repos/github/dreipol/django-cookie-monster/badge.svg?branch=develop)](https://coveralls.io/github/dreipol/django-cookie-monster?branch=develop)\n\nThis package gives you two versions of a cookie banner. The simple one is basically just a hint to inform users \nthat you are using cookies. The group version let's your users decide which cookies he needs.\n\nQuickstart\n----------\n\nInstall django-cookie-monster::\n\n pip install django-cookie-monster\n\nAdd it to your `INSTALLED_APPS`:\n\n```\nINSTALLED_APPS = (\n ...\n 'cookie_monster',\n ...\n)\n```\n\nAdd a type and data property to all script tags that store any cookies.\n```html\n<!-- before -->\n<script>// This is my script</script>\n\n<!-- after -->\n<script type=\"text/plain\" data-cookieconsent=\"the_ID_of_my_group\">// This is my script</script>\n```\n\nSettings\n--------\n\nOverwrite strings in your settings file. You will find a complete reference below. \n\n```python\nCOOKIE_MONSTER = {\n 'banner': {\n 'title': 'My Cookie Banner Title',\n }\n}\n```\n\nTo switch from standard to group mode you need to specify a list of setting groups.\n\n```python\nCOOKIE_MONSTER = {\n 'cookie_groups': {\n 'rows': [\n 'Name',\n 'Provider',\n 'Purpose',\n ],\n 'groups': [\n {\n 'title': 'Necessary',\n 'required': True,\n 'cookies': [\n {\n 'id': 'application',\n 'rows': [\n 'Language',\n 'example.com',\n 'site language',\n ],\n },\n ],\n },\n {\n 'title': 'Marketing',\n 'required': False,\n 'cookies': [\n {\n 'id': 'GTM',\n 'rows': [\n 'Google Tag Manager',\n 'Google.com',\n 'tracking cookie',\n ],\n },\n ],\n },\n ],\n },\n}\n```\n\n\nThis is an example of a fully customised version of a cookie banner:\n\n```python\nCOOKIE_MONSTER = {\n 'banner': {\n 'title': 'My Cookie Banner Title',\n 'text': 'This is my custom text with a dynamic <a href=\"https://example.com/\">link</a> to another page.',\n 'policy_link': 'contents.utils.my_callable_that_returns_a_dynamic_link_to_the_privacy_page',\n 'buttons': {\n 'confirm': {'label': 'Accept all cookies'},\n 'toggle': {'label': 'Toggle settings'},\n 'accept_all_cookies': {'label': 'Accept all Cookies'},\n 'accept_all_group_cookies': {'label': 'Accept {groupTitle} Cookies'}\n },\n },\n 'accordion_title': '{groupTitle} ({amount})',\n 'cookie': {\n 'samesite': 'Lax'\n },\n 'custom_theme': True,\n 'cookie_groups': {\n 'rows': [\n 'Name',\n 'Provider',\n 'Purpose',\n ],\n 'groups': [\n {\n 'title': 'Necessary',\n 'required': True,\n 'cookies': [\n {\n 'id': 'application',\n 'rows': [\n 'Language',\n 'example.com',\n 'site language',\n ],\n },\n ],\n },\n {\n 'title': 'Marketing',\n 'required': False,\n 'cookies': [\n {\n 'id': 'GTM',\n 'rows': [\n 'Google Tag Manager',\n 'Google.com',\n 'tracking cookie',\n ],\n },\n ],\n },\n ],\n },\n}\n```\n\n# Contribute\n\n## Installation\n\nTo install the frontend you will need to run:\n\n```sh\nnpm i\n```\n\n## Building frontend\n\nThe frontend can be built via:\n\n```sh\nnpm run build\n```\n\n## Unit test\n\nYou can unit test the frontend code with:\n\n```sh\nnpm test\n```\n\n\n\n\n\nHistory\n-------\n0.1.8.2 (2023-05-15)\n++++++++++++++++++\n\n* Simplify imports\n\n0.1.8.1 (2023-04-20)\n++++++++++++++++++\n\n* Include *.map files in source distribution\n\n\n0.1.8 (2023-02-02)\n++++++++++++++++++\n\n* Add Django 4 compatibility\n\n0.1.7 (2022-10-11)\n++++++++++++++++++\n\n* Add samesite configuration option\n\n\n0.1.6 (2022-01-31)\n++++++++++++++++++\n\n* Simplify banner text to prevent fails\n\nDEPRECATION WARNING:\n\n* The setting variable `policy_link` was removed due to errors. Please handle any text/link combinations yourself.\n\n\n0.1.5 (2021-02-15)\n++++++++++++++++++\n\n* Add plain html support for the groups labels\n\n\n0.1.4 (2020-05-13)\n++++++++++++++++++\n\n* Improve backward compatibility of browsers\n\n\n0.1.3 (2020-05-13)\n++++++++++++++++++\n\n* Fix translation issue in banner text\n\n\n0.1.2 (2020-04-09)\n++++++++++++++++++\n\n* Bugfix\n\n\n0.1.1 (2020-04-08)\n++++++++++++++++++\n\n* Bugfix\n\n\n0.1.0 (2019-10-16)\n++++++++++++++++++\n\n* First release on PyPI.\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Your project description goes here",
"version": "0.1.8.2",
"project_urls": {
"Homepage": "https://github.com/victoriameyer/django-cookie-monster"
},
"split_keywords": [
"django-cookie-monster"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c1ea73999a9a896893d24f004f59a596b56c4057ab4072d01f664a25bb615e33",
"md5": "58a8a4976fca4e69809bd33eeb5138df",
"sha256": "427d9c37754db47de8665b966b85902a3efdb8422988482653d0faecdf35b06e"
},
"downloads": -1,
"filename": "django-cookie-monster-0.1.8.2.tar.gz",
"has_sig": false,
"md5_digest": "58a8a4976fca4e69809bd33eeb5138df",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 200747,
"upload_time": "2023-05-15T15:11:53",
"upload_time_iso_8601": "2023-05-15T15:11:53.212763Z",
"url": "https://files.pythonhosted.org/packages/c1/ea/73999a9a896893d24f004f59a596b56c4057ab4072d01f664a25bb615e33/django-cookie-monster-0.1.8.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-15 15:11:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "victoriameyer",
"github_project": "django-cookie-monster",
"github_not_found": true,
"lcname": "django-cookie-monster"
}