-1

我已将表中的对象放入 2 个变量中。现在我想将这些变量的值发送到 html 使用render_to_response.

def AssetMovement(request):
    print "AssetMovement"
    feature_list = request.session['feature_list']
    featuresgroups = request.session['featuresgroups']
    pplid=request.session['pplid']
    empnm = Asset_Assignment_Employee.objects.filter(Employee__People=pplid)
    print empnm
    id_obj = Asset_Track.objects.all()
    print id_obj
    report = reports.astmvmt_repo(queryset=id_obj)
    report.generate_by(PDFGenerator, filename= 'E:\My Work Location\Example\WorkSpace\\asset_track1\media\\'+str(2)+".pdf")
    return render_to_response('asset_mgmt/astmvmtReport.html',{"contacts":feature_list,'root': settings.MEDIA_ROOT,'len':len(feature_list)-1,"featuresgroups":featuresgroups,'assertlist':id_obj})

像上面一样,我已经通过'assertlist'发送了id_obj,现在我想发送具有相同名称的empnm对象,即'assertlist'并显示在表格中。

请尝试尽快回答这个问题。谢谢你。

4

1 回答 1

0

除了上面的评论,另一种选择是使用{% with %}模板标签重新分配变量:https ://docs.djangoproject.com/en/1.4/ref/templates/builtins/#with

于 2013-01-30T12:54:53.387 回答