Simple fancybox modal for Django
Project description
This is a Django integration of Fancybox.
Installation
pip install django-fancybox
External dependencies
jQuery - This is not included in the package since it is expected that in most scenarios this would already be available.
Setup
Add fancybox to INSTALLED_APPS:
INSTALLED_APPS += (
'fancybox',
)
Be sure you have the django.template.context_processors.request processor
TEMPLATES = [
{
...
'OPTIONS': {
'context_processors': [
...
'django.template.context_processors.request',
],
},
},
]
and just include fancybox templates
{% include "fancybox/fancybox_css.html" %} {# Before the closing head tag #}
{% include "fancybox/fancybox_js.html" %} {# Before the closing body tag #}
When deploying on production server, don’t forget to run :
python manage.py collectstatic
Usage
Extend base template for ajax requests
{% extends request.is_ajax|yesno:"fancybox/base.html,base.html" %}
Add class="fancybox" to a link, and set the href to a page you want to display
<a data-fancybox data-type="ajax" href="{% url 'remote.html' %}" class="fancybox">Click here</a>
Please see example application. This application is used to manually test the functionalities of this package. This also serves as a good example.
You need only Django 1.4 or above to run that. It might run on older versions but that is not tested.
License
django-fancybox is released under the BSD license.
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
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-fancybox-0.1.6.tar.gz.
File metadata
- Download URL: django-fancybox-0.1.6.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0e044b1f4833f0d6282fb5daca86e33296915e6c8c05d07a20d2adb1fa430bb
|
|
| MD5 |
08a3136ed1e0b9c9f133d853defe94ec
|
|
| BLAKE2b-256 |
e06d678452ea9e4051c8593b9a800fd20bbc64ba06f2e5f72f4e22399cb58a27
|
File details
Details for the file django_fancybox-0.1.6-py2.py3-none-any.whl.
File metadata
- Download URL: django_fancybox-0.1.6-py2.py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfbbbf46966ecc0738dddb46cadfbc88164a4b2266a97b37356df1f54995cbc2
|
|
| MD5 |
2497d8ec1ba8dc70ecddf98d40ce5673
|
|
| BLAKE2b-256 |
40f8df0207fbcdf4814f695b2c389eed51f85d914df116eaa4eeab6d895385a4
|