alternative for a full screen javascript lightbox for the django framework
Project description
=============
LIGHTBOX PAGE
=============
This is an alternative for a full screen javascript lightbox. LIGHTBOX PAGE brings
the user to a separate page, not an overlay. So this is only useful for
full screen lightbox.
Quick Start
===========
Add lightbox to your INSTALLED APPS
To settings, add LIGHTBOX_MODEL with the parent model name, and
LIGHTBOX_APP with the app where this model lives.
Defaults are model: 'Page', app: 'base'
Add lightbox.middleware.MobileDetectMiddleware to your middleware classes.
Add the following to your urls.py:
from lightbox.views import ImagePageView
In url patterns, add something like this::
url(r'^lightbox/(?P<pk>\d+)/(?P<path>.*)/(?P<page>[0-9]+)/$',
ImagePageView.as_view(), {'app': 'ccnet', 'model': 'communication',
'related_name': 'files'}, name="lightbox"),
As you can see, you will need to specify app, model and related name as keyword arguments.
Add ImagePageContextMixin to your views. This will provide the context.
Example:
=======
from lightbox.views import ImagePageContextMixin
from django.views.generic import ListView
from models import Page
class CustomView(ImagePageContextMixin, ListView):
template_name = 'index.html'
If you are not using class-based views, and you wish to use
the last call structure, you may enter the
context for the path variable as follows:
from lightbox.views import encode_url
def some_function(request, [...]):
....
path = encode_url(request)
return render_to_response('your_template_name.html', {'path': path, [...: ...]})
Options:
=======
LIGHTBOX_WIDTH = '1600'
LIGHTBOX_WIDTH_MOBILE = '800'
LIGHTBOX_IMAGE_CLICKABLE = False
LIGHTBOX_BG_COLOR = '#000'
LIGHTBOX_TXT_COLOR = '#fff'
LIGHTBOX_VIEWABLE_HEIGHT_FACTOR = 0.85
LIGHTBOX_VIEWABLE_WIDTH_FACTOR = 0.85
LIGHTBOX_IMAGE_WINDOW_HEIGHT_FACTOR = 0.71
LIGHTBOX_IMAGE_WINDOW_WIDTH_FACTOR = 0.71
LIGHTBOX PAGE
=============
This is an alternative for a full screen javascript lightbox. LIGHTBOX PAGE brings
the user to a separate page, not an overlay. So this is only useful for
full screen lightbox.
Quick Start
===========
Add lightbox to your INSTALLED APPS
To settings, add LIGHTBOX_MODEL with the parent model name, and
LIGHTBOX_APP with the app where this model lives.
Defaults are model: 'Page', app: 'base'
Add lightbox.middleware.MobileDetectMiddleware to your middleware classes.
Add the following to your urls.py:
from lightbox.views import ImagePageView
In url patterns, add something like this::
url(r'^lightbox/(?P<pk>\d+)/(?P<path>.*)/(?P<page>[0-9]+)/$',
ImagePageView.as_view(), {'app': 'ccnet', 'model': 'communication',
'related_name': 'files'}, name="lightbox"),
As you can see, you will need to specify app, model and related name as keyword arguments.
Add ImagePageContextMixin to your views. This will provide the context.
Example:
=======
from lightbox.views import ImagePageContextMixin
from django.views.generic import ListView
from models import Page
class CustomView(ImagePageContextMixin, ListView):
template_name = 'index.html'
If you are not using class-based views, and you wish to use
the last call structure, you may enter the
context for the path variable as follows:
from lightbox.views import encode_url
def some_function(request, [...]):
....
path = encode_url(request)
return render_to_response('your_template_name.html', {'path': path, [...: ...]})
Options:
=======
LIGHTBOX_WIDTH = '1600'
LIGHTBOX_WIDTH_MOBILE = '800'
LIGHTBOX_IMAGE_CLICKABLE = False
LIGHTBOX_BG_COLOR = '#000'
LIGHTBOX_TXT_COLOR = '#fff'
LIGHTBOX_VIEWABLE_HEIGHT_FACTOR = 0.85
LIGHTBOX_VIEWABLE_WIDTH_FACTOR = 0.85
LIGHTBOX_IMAGE_WINDOW_HEIGHT_FACTOR = 0.71
LIGHTBOX_IMAGE_WINDOW_WIDTH_FACTOR = 0.71
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
DjangoLightbox-0.1.5.tar.gz
(19.2 kB
view hashes)