Glide JS integration for Django
Project description
django-glide
This is a Django library to add support to Glide JS in your templates
It supports:
- Django 3
- Django 4
- Django 5
Installation
pip install django-glide
Setup
First, add "django_glide" to your list of INSTALLED_APPS.
Then either in your base template (to load on all pages) or just in the template you need, add:
{% load glide_tags %}
{% glide_assets %}
Then to actually use a glide based carousel, use this in your template:
{% load glide_tags %}
...
{% glide_carousel my_images carousel_id="hero" type="carousel" perView=3 autoplay=3000 %}
All the options listed on the example above can be found here: https://glidejs.com/docs/options/
And then in your view, return an object in the context following this format:
my_images = [
{"image": "/static/img/slide1.jpg", "alt": "Slide 1"},
{"image": "/static/img/slide2.jpg", "alt": "Slide 2"},
{"image": "/static/img/slide3.jpg", "alt": "Slide 3"},
]
Using custom template
By default, the template shipped with the library is basic, it can either load an image or some text. If you wish to use your own template, create a separate file to hold your whole slide and then call it like so:
{% glide_carousel my_custom_data carousel_id="hero" template_name="myapp/custom_slide.html" type="carousel" perView=3 autoplay=3000 %}
Changing the way GlideJS is loaded
By default, this library uses lastest Glide of the jsdelivr CDN, if you want to change this, you can modify one (or all) of the following settings:
GLIDE_JS_URL = "my new URL to fetch the JS"
GLIDE_CSS_CORE_URL = "my new URL to fetch the core CSS"
GLIDE_CSS_THEME_URL = "my new URL to fetch the theme CSS"
Development
Installing for development:
make install
Cleaning the installation:
make clean
Format the code:
make format
Check the code (for linting errors):
make check
Check the code (python type checker):
make static-check
Running all tests:
make test
Create a sdist+bdist package in dist/:
make package
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_glide-0.1.1.tar.gz.
File metadata
- Download URL: django_glide-0.1.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8eb5ef5d008e0f676362ee760fe12d6f23348e38d7241d5d9c3f2394ced82f1d
|
|
| MD5 |
1b5685aa10b9f9cbb8eaf2d34507ce58
|
|
| BLAKE2b-256 |
7e13bc087ea60f9fa9974c0d6cf22683f13e232e259d9a4a8c1bd6d4cd5d38d9
|
File details
Details for the file django_glide-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_glide-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d635b5a9dcbc2e6cfeef011f5f3f960325e7beadc9fb2eac16d2ea59b5fc896
|
|
| MD5 |
490705fd1d26d1525f2d189ced816fe1
|
|
| BLAKE2b-256 |
e6502b0757954e3863a18aa87645566dc582410f74bb213cb28a883daa685a64
|