Skip to main content

No project description provided

Project description

Introduction

You can have multiple Slideshows and each of them have their own slides. Slides can be ordered and they contains a title, an optional content text, an optional URL and an optional image.

Slideshows can use custom templates and custom config templates. Config templates are used to contains some Javascript to configure/initialize your slideshow with your slider library. But by default a Slideshow item have no config template, this is optional.

It does not contains any assets to integrate it in your site, this is at your responsability to integrate it (choose and install your slider library, add your assets where you need, customize the template, etc..).

Require

Optional

Ckeditor

A Ckeditor django app can be installed to use it for the Slide.content model attribute instead of the simple TextField.

So it is at your responsability to manualy install (with pip, buildout, etc..) one of them if you need it. Once it’s installed, you won’t need to worry about this again.

Note that the default assumed app is djangocms_text_ckeditor and if not installed, django-ckeditor will be assumed. If you have installed both, djangocms_text_ckeditor will be used. If none of them is installed, the default Django field TextField will be used.

Choosing what app to install depends mostly from if you have allready installed DjangoCMS or not. If you have, you probably allready have its ckeditor app installed, so no need to install the other app because. If you don’t have installed DjangoCMS, just install django-ckeditor.

Finally you can add custom settings for CKeditor, see its documentation to see how to set them (you may have to go to official CKeditor documentation to know about available settings).

Install

Add it to your installed apps in the settings :

INSTALLED_APPS = (
    ...
    'slideshows',
    'filebrowser',
    ...
)

If you have installed one of the django app for CKeditor, add it also to your settings.INSTALLED_APPS.

Then add its settings :

from porticus.settings import *

See the app settings.py file to see what settings you can override.

Also there is some settings you may see about django-filebrowser-no-grappelli (see its documentation for more details).

And add its views to your main urls.py :

from django.conf.urls import url, patterns
from filebrowser.sites import site as filebrowser_site

urlpatterns = patterns('',
    ...
    url(r'^slideshows/', include('slideshows.urls', namespace='slideshows')),
    url(r'^admin/filebrowser/', include(filebrowser_site.urls)),
    ...
)

Finally install app models in your database using Django migrations:

python manage.py migrate

Usage

The process to build the HTML will be to generate the optional config HTML if any, then generate the content HTML.

The common way is to display a Slideshow with all slides, this is called the Slides show. And there is another mode called Random slide which only display a single slide taked randomly from a Slideshow published slides.

With the template tag

Create your slideshow from the admin, feed it with some slides, then use it in your templates :

{% load slideshows_tags %}
...
{% slideshow_render 'your-slug' %}

The first argument accept either a slug string or a Slideshow instance.

Also you can override the content template and the config template saved within the template tag :

{% load slideshows_tags %}
...
{% slideshow_render 'your-slug' 'slideshows/slides_show/custom.html' 'slideshows/slides_show/configs/custom.html' %}

(Use 'None' as the second argument if you just want to override the config template).

Note that if the given Slideshow slug does not exist, this will raise a Http404.

With the views

Views use the defined template in Slideshow instance, there is no particular process to define.

  • You can reach a slideshow view with an url like /slideshows/show_slides/SLUG/ where SLUG is the defined slug on the Slideshow object;

  • You can reach the random image mode for a slideshow view with an url like /slideshows/random_slide/SLUG/ where SLUG is the defined slug on the Slideshow object;

Within DjangoCMS pages

You can install an additional package to use your slideshows in pages placeholder contents. See cmsplugin-slideshows.

Templates

Slideshow content templates will have the following context variables :

  • slideshow_js_config : the generated config template if any, else an empty string;

  • slideshow_instance : the Slideshow model instance;

  • slideshow_slides : a queryset of published slides for the Slideshow instance;

Slideshow config templates will have the following context variables :

  • slideshow_instance : the Slideshow model instance;

  • slideshow_slides : a queryset of published slides for the Slideshow instance;

This is available for the template tag and also the cms plugin.

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

emencia-django-slideshows-1.1.0.tar.gz (11.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page