之前引用局部变量“TOTO”我得到一个错误使用Django和我没有找到一个解决方案:UnboundLocalError:分配
UnboundLocalError在/身份/ RECHERCHE局部变量“TOTO” 分配
之前引用
这是我的脚本的一部分:
def Consultation(request) :
identity = Identity.objects.all().order_by("-id")[:10] #Les 10 dernières fiches créées
identity_France = Identity.objects.filter(country='64').order_by("-id")[:10] #Les 10 dernières fiches où la personne habite en France
query = request.GET.get('q')
if query :
toto = Identity.objects.filter(lastname__icontains=query)
context = {
"identity" : identity,
"identity_France" : identity_France,
"query" : query,
"toto" : toto,
}
return render(request, 'resume.html', context)
太谢谢你了:)
[托托(https://www.youtube.com/watch?v=FTQbiNvZqaY0)? –
@DanielRoseman好笑话;)在法国,toto是常用变量名称:P – Deadpool