Question

When I introduce sorl-thumbnail into my template, it breaks.

Here is the part that works:

{% for product in products %}
    <ul class="thumbnails">
        {% for productImage in product.images.all %}
            ...
        {% endfor %}
...
{% endfor %}

and this is what doesn't:

{% load thumbnail %}
{% for product in products %}
    <ul class="thumbnails">
        {% for productImage in product.images.all %}
            <li class="span4">
                {% thumbnail productImage.image "160x200" as im %}
                    <img src="{{ im.url }}" alt = "" />
                {% endthumbnail %}
            </li>   
        {% endfor %}
...
{% endfor %}

And this is what happens:

Exception Type: TemplateSyntaxError
Exception Value:    
Caught DatabaseError while rendering: current transaction is aborted, commands ignored until end of transaction block

1   {% load thumbnail %}
2   {% for product in products %}

The second line is marked in red.

Also, if I only use the {% load thumbnail %} tag and leave out the rest, everything is fine (except I don't get to display those nice thumbnails).

Any ideas on what the problem might be?

Was it helpful?

Solution

Probably answering my own question... setting

THUMBNAIL_DEBUG = True

led to this error:

Caught DatabaseError while rendering: relation "thumbnail_kvstore" does not exist
LINE 1: ..._kvstore"."key", "thumbnail_kvstore"."value" FROM "thumbnail...

I had accidentally turned off memcached, AND forgotten to update my db for sorl.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top