https://github.com/briefmnews/django-cookie-consent-authenticateduser
Plugin for django-cookie-consent app that saves cookie preferences for authenticated users.
https://github.com/briefmnews/django-cookie-consent-authenticateduser
cookie cookie-consent-plugin django-cookie-consent
Last synced: about 1 year ago
JSON representation
Plugin for django-cookie-consent app that saves cookie preferences for authenticated users.
- Host: GitHub
- URL: https://github.com/briefmnews/django-cookie-consent-authenticateduser
- Owner: briefmnews
- License: mit
- Created: 2021-01-26T13:44:14.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-10T18:12:23.000Z (over 1 year ago)
- Last Synced: 2025-02-03T21:52:47.074Z (over 1 year ago)
- Topics: cookie, cookie-consent-plugin, django-cookie-consent
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-cookie-consent-authenticateduser
[](https://www.python.org/downloads/release/python-390/)
[](https://docs.djangoproject.com/en/3.2/)

[](https://codecov.io/gh/briefmnews/django-cookie-consent-authenticateduser)
[](https://github.com/python/black)
Plugin for [django-cookie-consent app](https://github.com/briefmnews/django-cookie-consent) that saves user's cookie preferences in the database.
## Installation
You need to install `django-cookie-consent` first:
```
pip install -e git://github.com/briefmnews/django-cookie-consent@plugin#egg=django-cookie-consent
```
Then, install the `django-cookie-consent-authenticateduser` plugin:
```
pip install -e git://github.com/briefmnews/django-cookie-consent-authenticateduser@main#egg=django-cookie-consent-authenticateduser
```
## Setup
In order to make `django-cookie-consent-authenticateduser` works, you'll need to follow the steps below:
### Settings
First, you need to add the app, the middleware and the context processor to your settings:
```python
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'cookie_consent',
'cookie_consent_authenticateduser',
...
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'cookie_consent_authenticateduser.middleware.CheckAuthenticatedUserCookieContentMiddleware',
...
)
TEMPLATES = [
{
...,
"OPTIONS": {
"context_processors": [
...,
"cookie_consent_authenticateduser.context_processors.display_cookie_consent",
...,
],
},
}
]
```
## Tests
Testing is managed by `pytest`. Required package for testing can be installed with:
```
pip install -r requirements.txt
```
To run testing locally:
```
pytest
```