Skip to main content

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


Download files

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

Source Distribution

django_glide-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_glide-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file django_glide-0.1.0.tar.gz.

File metadata

  • Download URL: django_glide-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for django_glide-0.1.0.tar.gz
Algorithm Hash digest
SHA256 611b4b35541286ed4613d2b8b23e5a117700bfbe0489c8ddabc85bf0dad8c00d
MD5 70ca5743c35531e1665cd40329ec9b9a
BLAKE2b-256 f6472da3805dab35441b193d46b0a7ea656fb6a6d4a3d0dce52c639a819b5c99

See more details on using hashes here.

File details

Details for the file django_glide-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_glide-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for django_glide-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e780b7cddcbc03040174fc0951e809124170bb0cd63c955dd09013400123c38
MD5 8a80b9d41df26ddd65d6ebba22de3fed
BLAKE2b-256 caacb2203592f9550c565aeee226f73ecfe34e3831dd6165f8a2a3f4d3211c37

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