Plugin for django-cookie-consent app that saves user's cookie preferences in the database.
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
In order to make django-cookie-consent-authenticateduser
works, you'll need to follow the steps below:
First, you need to add the app, the middleware and the context processor to your settings:
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",
...,
],
},
}
]
Testing is managed by pytest
. Required package for testing can be installed with:
pip install -r requirements.txt
To run testing locally:
pytest