我的tag.py
from django import template
register = template.Library()
@register.simple_tag()
def validator(data2, b):
nop = False
for data1 in b:
if data2.pk == data1.mix_id:
nop = True
else:
correct=data2
if nop :
pass
else:
print(correct)
return correct
我的template.html
{% for data2 in mix.qs %}
{% validator data2 vuelos.qs as data3 %}
{{data3}}
{{data3}}的输出
None
tag.py文件中的打印输出是一个列表,它正是我要保存在data3上的内容,但是代码仅退出None。有任何建议吗?
答案 0 :(得分:0)
解决方案在tag.py
中// var zero = $('.uploaded_photo_grid.0').length;
var numImages = $('.up_preview').children().length;
if (numImages === 0) {
//...
} else {
uploadSingleFile(this.files[i+1], numImages + i + 1);
}