Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A Django app to easily integrate a banner about EU Cookie Law

Project description

A Django app to easily integrate a banner about EU Cookie Law

Display a HTML banner (or whatever you want if you override the template) to inform about European Cookie Law with a link for more informations and another link to accept and continue to browse site. Once clicked the accept link push a cookie to the browser so the banner won’t never display again.

Requires

Install

First install the package

pip install emencia-cookie-law

Add it to your installed Django apps in settings :

INSTALLED_APPS = (
    ...
    'cookie_law',
    ...
)

Now you will need to integrate it in your templates.

Optional settings

COOKIELAW_TEMPLATE

Default to cookie_law/banner.html.

The filepath to the banner template. You should not really need to edit this settings to change the banner aspect, just override the template with the same relative filepath in your project templates directory.

Templates integration

Recommended way is to have a basic file for all your project templates, often named base.html or skeleton.html, so you’ll just integrate cookie_law only once.

  1. In your template(s), load the Javascript file:

    <script type="text/javascript" src="/static/js/cookie_law/cookie_law.js"></script>
    

    Don’t forget jQuery and jquery.cookie requirements to be loaded before this plugin (if you are using Foundation, they are allready loaded).

  2. Load the the cookie_law tag library at top of your template:

    {% load cookie_law %}
    
  3. Then call its tag where you want, commonly as the first element in your <body/> content:

    {% cookie_law_banner %}
    

Default template has been made with Foundation components, if you don’t use it or use another CSS Framework, you should override it see setting COOKIELAW_TEMPLATE.

Because the default template has been done for Foundation, there is no need of any CSS to load.

Usage

Nothing special. The banner display until you accept the game from the button within the banner.

Once accepted the browser is given a cookie so the user won’t see again the banner. The cookie lifetime expires in 10 years since accept.

Project details


Release history Release notifications

This version
History Node

0.2.3

History Node

0.2.1

History Node

0.2.0

History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
emencia-cookie-law-0.2.3.tar.gz (7.0 kB) Copy SHA256 hash SHA256 Source None Oct 27, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page