在views.py一侧,我从数据库中获取外部图像网址并将其发送到模板:
for variable in our_list:
thumbnail = ExternalAPICall(id=variable[0], 'thumbnail') #returns http://img48.imagesuit.gp/423ad3af.png
...
variable.append(thumbnail)
...
context = {
...
'our_list': our_list,
...
}
return render(request, 'index.html', context)
在模板一侧,我加载缩略图并用缩略图操作符进行装饰:
{% load thumbnail %}
...
{% for id, ... thumb ... in our_list %}
...
{% thumbnail thumb "100x100" crop="center" as im %}
<img alt="" src="{{ im.url }}" width="164" style="max-width:175px;border:0;min-height:auto;outline:none;text-decoration:none;vertical-align:bottom" class="CToWUd">
{% endthumbnail %}
{% endfor %}
它呈现空行而不是图像行。
怎么了?