嗨,我需要从一个函数在两个模板上 呈现数据,我的代码是
def stylepoints(request):
a=Product.objects.all()[:3]
cursor = connection.cursor()
try:
cursor.execute("SELECT facebook_id,name FROM django_facebook_facebookuser WHERE user_id = %s ORDER BY RAND() LIMIT 1",[request.user.id])
except Exception as e:
return HttpResponse("error in fetching Friends")
rows_affected=cursor.rowcount
if rows_affected > 0:
row1 = cursor.fetchall()
row12 = row1[0]
else:
row12 = ''
value = request.user.id
cursor12 = connection.cursor()
cursor12.execute("SELECT Distinct email FROM myaccount_invitation WHERE reference_id = %s AND status = 1 AND invitation_type = 2",[value])
friend = cursor12.fetchall()
if friend:
friends = friend[0]
return render_to_response('swf.html',{'a':a,'userf':row12,'friendshow':friend} , context_instance=RequestContext(request))
像这样我已经将数据发送到一个模板名称
swf.html
但我还需要将数据发送到另一个模板,例如
swf2.html
请告诉我我可以将数据渲染到两个模板吗