from __future__ import unicode_literals
from mezzanine import template
from mezzanine.conf import settings
from ..models import Slider

register = template.Library()

@register.inclusion_tag("slider_revolution/slider.html", takes_context=True)
def slider(context, slug):
    """
    Renders a slider.
    """
    try:
        slider = Slider.objects.get(slug=slug)
        settings.use_editable()
        slides = slider.slides.all()
        context['slider'] = slider
        context['slides'] = slides
    except Slider.DoesNotExist:
        print 'none'
        context['slider'] = None
    return context


@register.inclusion_tag("slider_revolution/slider_js_media.html", takes_context=True)
def slider_js_media(context, slug):
    """
    Renders a slider js media.
    """
    context['slider_id'] = '#{}'.format(slug)
    return context


@register.inclusion_tag("slider_revolution/slider_css_media.html", takes_context=True)
def slider_css_media(context, slug):
    """
    Renders a slider css media.
    """
    context['slider_id'] = '#{}'.format(slug)
    return context
@@ -533,29 +533,8 @@
 st:%0A
-        print 'none'%0A
     

clean up