Search code examples
djangodjango-templatessorl-thumbnail

Django TemplateSyntax Error with Sorl-thumbnail


I'm trying to get Sorl-thumbnail running on my staging server, but I'm running into a TemplateSyntaxError which is throwing me since the app works fine on localhost.

The error is coming in at {% endthumbnail %}

TemplateSyntaxError at /home/
Invalid block tag: 'endthumbnail', expected 'endif'

Any help would be greatly appreciated. Thanks!

{% load thumbnail %}

{% if picture.photo_medium %}
    <img src="{{AWS_URL}}{{picture.photo_medium}}" class="imagepage" width="400" height="300">
{% else %}
    {% if picture.photo_large|is_portrait %}
       <div class="portrait">
          {% thumbnail picture.photo_large "400" crop="center" as im %}
          <img src="{{AWS_URL}}{{ im }}">
       </div>
    {% else %}
       <div class="landscape">
          {% thumbnail picture.photo_large "400" crop="center" as im %}
          <img src="{{AWS_URL}}{{ im }}">
       </div>
    {% endif %}
{% endif %}

Solution

  • I might be wrong, but I don't think you need the {% endthumbnail %} tag.