Cookie Consent
A Django app to add a cookie consent modal to your site. This can then be used to check if the user has given consent to use cookies.
To clear the cookie preferences; the user can simple navigate to:
reverse('cookie_consent:revoke')
In templates; it is also possible to check if the user has given consent like so:
request.cookie_consent.allows('analytics') -> bool
Quick start
-
Add 'cookie_consent' to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ..., 'cookie_consent', ] -
Include the cookie_consent URLconf in your project urls.py like this:
path('cookies/', include('cookie_consent.urls')), -
Add the cookie_consent middleware to your MIDDLEWARE setting like this:
MIDDLEWARE = [ ..., 'cookie_consent.middleware.CookieConsentMiddleware', ] -
Use the 'cookie_consent' template tag in your base template like this:
{% load cookies_tags %} {% cookie_consent %} -
Check if the user has given consent to use cookies in your templates like this:
{% consents_to 'analytics' %} <script> // Will only get rendered if the user has given consent to use analytics cookies. </script> {% endconsents_to %}
Metadata
Release files for dc-consent 1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dc_consent-1.tar.gz | 20.5 kB | Details |
Release files / dc_consent-1.tar.gz
| Download URL | dc_consent-1.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f15457650d010a62a8b919104aadc2bfc21cf5d6e5a4facd8e1c50d0a0e7bb8
|
|
BLAKE2b-256 checksum How to use checksums |
bb06ef664c55fdc8187cb9b2522bc79fbddadb98bbd71bfc1a18391306e4baa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|