14
In Django I want to add a variable to the request. i.e,
def update_name(request):
names = Employee.objects.filter()
if names.count() > 0:
request.update({"names": name })
return render_to_response('chatlist/newchat.html',
context_instance=RequestContext(request, {'form': form,'msg': msg}))
Is this the right way to add a variable to the request? If not, how should I do it?
Also, how can I retrieve the same value in the templates page? i.e,
alert ("{{request.names['somename']}}");