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:
Head - Top
Head - Bottom
Body - Top
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
Close
Hashes for django-script-pattern-0.3.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f514db3c0c1c191a1845c78ace662e192c884150fd24c64a686956a344652c91 |
|
MD5 | bcb43aa5c352fdd99f2e2a7e6be646c4 |
|
BLAKE2b-256 | edcddd4a01eaa98b8dfb241cd4df1e7166c436181e2fbed755a9912345023e9f |