-1

嗨,我有一个简单的视图,我试图将功能传递给 html 页面,但它给了我以下错误:

UnboundLocalError at /enquiry/thanks/
local variable 'features' referenced before assignment

而我的看法

 def abc(request):

    features = ['1','2','3','4','5','6','7','8','9','0']
        return render_to_response("xyz/thanks.html",
        {
             'test': features,
        }, context_instance=RequestContext(request))
4

1 回答 1

0

应该:

 def abc(request):
    features = ['1','2','3','4','5','6','7','8','9','0']
    return render_to_response("xyz/thanks.html",{
                   'test': features,
           }, context_instance=RequestContext(request))
于 2012-09-17T12:17:05.973 回答