Skip to main content

Django script pattern app

Project description

django-script-pattern

This app allows you to add script blocks into your pages using url patterns like:

  • /category/*

  • /*/subcategory/*

# Includes GET parameters

  • /products/catalog/*category=some-category*

Use * to pass any symbols and $ as the end.

Available to use four block locations:

  1. Head - Top

  2. Head - Bottom

  3. Body - Top

  4. Body - Bottom

Installation

Install with pip:

$ pip install django-script-pattern

Update INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'script_pattern',
    'django-admin-sortable2',
    'django_jinja',  # optional for jinja2 global function
    ...
]

Apply migrations:

$ python manage.py migrate

Example to use:

#layout.jinja
<html lang="en">
    <head>
        {{ get_script_pattern(request, 'head', 'top') }}
        ...
        some head content
        ...
        {{ get_script_pattern(request, 'head', 'bottom') }}
    </head>

    <body>
        {{ get_script_pattern(request, 'body', 'top') }}
        ...
        some body content
        ...
        {{ get_script_pattern(request, 'body', 'bottom') }}
    </body>
</html>

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

django-script-pattern-0.3.3.tar.gz (9.0 kB view details)

Uploaded Source

File details

Details for the file django-script-pattern-0.3.3.tar.gz.

File metadata

  • Download URL: django-script-pattern-0.3.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for django-script-pattern-0.3.3.tar.gz
Algorithm Hash digest
SHA256 e4bcc734f801e3bda558c841c77ce7c56efde36f111b7c681fc233866c419e6e
MD5 f162aa03f4de8166c1792c7d7fc06307
BLAKE2b-256 1afa50691a29b811da5a2690d69e07be5ac78969e77b8723f5e9a8c520249587

See more details on using hashes here.

Supported by

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