<div class="slider-wrapper">
    <div id="slider" class="nivoSlider">
        {% for slide in slider.slide_set.all %}
            {% if slide.url %}<a href="{{slide.url}}">{% endif %}
                <img src="{{slide.image.url}}" alt="{% if slide.alt %}{{ slide.alt }}{% else %}{{slide.name}}{% endif %}" title="#caption-{{forloop.counter}}">
            {% if slide.url %}</a>{% endif %}
        {% endfor %}
    </div>
</div>
{% for slide in slider.slide_set.all %}
    {% if slide.description %}
        <div id="caption-{{forloop.counter}}" class="nivo-html-caption">
            {{ slide.description|safe }}
        </div>
    {% endif %}
{% endfor %}
