Registry / analytics / django-cookie-consent

django-cookie-consent

JSON →
library1.0.0pypypiunverified

Django application for managing cookie consent, providing models, views, and template tags to collect and store user consent for different cookie groups. Current version 1.0.0, requires Python >=3.10 and Django >=4.2. Active development with monthly releases.

pip install django-cookie-consent
INSTALL
IMPORT
SIG · DJANGO-COOKIE-CONS
D
django-cookie-consent
analyticspythonv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CookieGroup
from cookie_consent.models import CookieGroup
from cookie_consent.models import CookieGroup

Add app to INSTALLED_APPS, run migrations, and use template tags to show a cookie banner.

# Add to INSTALLED_APPS in settings.py INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'cookie_consent', ] # Run migrations # python manage.py migrate cookie_consent # In templates, load the templatetag: {% load cookie_consent_tags %} {% if not request|cookie_group_accepted:"analytics" %} {% include "cookie_consent/cookie_banner.html" %} {% endif %}
Debug
Known issues
gotchaThe template tag 'cookie_group_accepted' expects a string argument matching the CookieGroup name, not the varname. If you use the wrong attribute, acceptance checking will fail silently.
fix
Ensure you pass the CookieGroup's 'name' field (slug) to the filter, e.g., 'analytics', 'functional'.
affects: all
deprecatedThe 'accept_cookies' and 'decline_cookies' views in older versions were renamed to 'accept' and 'decline'. Using old view names will break in v1.0.
fix
Use 'cookie_consent.views.accept' and 'cookie_consent.views.decline' in URL patterns.
affects: >=0.9,<1.0
Upgrade
Version history
1.0.0latest on PyPI · released Feb 4, 2026
Audit
Dependencies
djangorequiredRequired Django version >=4.2
Agent activity
23 hits · last 30 days
node
20
Resources

No resource links recorded.

django-cookie-consent — pip install django-cookie-consent · libregistry