from django.template import loader,Context
def view_1(request)
t=loader.get_template('template1.html')
c=Context({
'app':'my app',
'user':request.user,
'ip_address':request.META['REMOTE_ADDR'],
'message':'I am view 1'})
return t.render(c)
from django.template import loader,RequestContext
def custom_proc(request):
return {
'app':'my app',
'user':request.user,
'ip_address':request.META['REMOTE_ADDR']
}
def view_1(request):
t=loader.get_template('template1.html')
c=RequestContext(request,{'message':'I am view 1'},processors=[custom_proc])
return t.render(c)
from django.template import RequestContext
from django.shortcuts import render_to_response
def custom_proc(request):
return {
'app':'my app',
'user':request.user,
'ip_address':request.META['REMOTE_ADDR']
}
def view_1(request):
return render_to_response('template1.html',{'message':'I am view 1.'},
context_instance=RequestContext(request,processors=[custom_proc]))