Skip to main content

Adds header and tail scripts from addons.

Project description

pypi build coverage

Aldryn Snake adds tail and head context processors for addons similar to django-sekizai.

This addon still uses the legacy “Aldryn” naming. You can read more about this in our support section.

Contributing

This is a an open-source project. We’ll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

We’re grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

Documentation

See REQUIREMENTS in the setup.py file for additional dependencies:

python django

Installation

  • add aldryn_snake.template_api.template_processor to your TEMPLATE_CONTEXT_PROCESSORS settings

  • somewhere in your app (that will be imported on startup (models, admin etc) add something to the api:

        from aldryn_snake.template_api import registry
    from django.conf import settings
    
    OPTIMIZELY_SCRIPT = """<script src="//cdn.optimizely.com/js/%(account_number)s.js"></script>"""
    
    
    def get_crazyegg_script():
      optimizely_number = getattr(settings, 'OPTIMIZELY_ACCOUNT_NUMBER', None)
      if optimizely_number:
          return OPTIMIZELY_SCRIPT % {'account_number': optimizely_number}
       else:
          return ''
    
    registry.add_to_tail(get_crazyegg_script())

If add_to_tail or add_to_head receive a callable, it will be called with the request keyword argument.

  • add the following in your base template to the HEAD:

    {{ ALDRYN_SNAKE.render_head }}
  • add the following in your base template right above </BODY>:

    {{ ALDRYN_SNAKE.render_tail }}

Running Tests

You can run tests by executing:

virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test

Project details


Download files

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

Source Distribution

aldryn-snake-2.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

aldryn_snake-2.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file aldryn-snake-2.0.0.tar.gz.

File metadata

  • Download URL: aldryn-snake-2.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for aldryn-snake-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1264c7ef2b601a81e3882333d2a62093c581168c5dc0f01caedbbe3db898bf38
MD5 8e3dbd7244ad0e2db5f43a54f8d004e9
BLAKE2b-256 ec30ccb773b1c9d376bcb9f0afe2247cd32adfd14b5735a75d10ee1d63bed962

See more details on using hashes here.

Provenance

File details

Details for the file aldryn_snake-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: aldryn_snake-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for aldryn_snake-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad9fd858d63ad4a417d92e49e974137ac29a31b87d30579dba29597f4eac0f27
MD5 86f40a9b8dbfbd54d4ee3135f8769005
BLAKE2b-256 580a655a6fedd1ab8a5c6809c6165f15a3a030712742ff4f79e9d18633ce19c6

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page