Skip to content

Django CMS Template imagestore_album.html and prettyPhoto #36

@ghost

Description

Hi,
i would like to use the imagestore app inside my small django cms project. After executing the tutorial i get really fast a good result. The only problem i run into is that the javascript snippet inside the template imagestore_album.html throughs an error. It's not able to find the CMS object (unresolved reference).

So i take a look at your application and found a solution for me by modify the template. The difference is the usage of sekizai and the django cms predefined block tags.

{% load thumbnail %}
{% load sekizai_tags %}
{% load staticfiles %}

{% addtoblock "css" %}
<link rel="stylesheet" href={% static "css/prettyPhoto.css" %} type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
{% endaddtoblock %}

<div id='gallery'>
    {% for image in album.images.all %}
        {% thumbnail image.image "120x120" crop="center" as im %}
            {% thumbnail image.image "600x600" as full %}
                <a rel='gallery[pp_gal]' href="{{ full.url }}">
                        <img class="preview" {% if image.title %} alt="{{ image.title }}" {% endif %} src="{{ im.url }}">
                </a>
            {% endthumbnail %}
        {% endthumbnail %}
    {% endfor %}

    {% addtoblock "js" %}
    <script type="application/javascript" src={% static "js/jquery.prettyPhoto.js" %}></script>
    <script type="text/javascript" charset="utf-8">
    CMS.$(function() {
        $("a[rel^='gallery']").prettyPhoto({
            allow_resize: true,
            changepicturecallback: function() {
                $(".pp_overlay").css("height", $(document).height());
            }
        });
    });
    </script>
    {% endaddtoblock %}
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions