how to pass the variable from included template to the template where it is included?
问题 In Django Views:- if request.is_ajax(): t = get_template('bar-templates.html') html = t.render(Context({'edit': True, 'user':'some-user' })) return HttpResponse(html) There is two templates: Main template (foo-templates.html) which includes the template (bar-templates.html) . In context edit and user is passed to the bar-templates.html But this variable is also used in foo-templates.html . In django we used to {{ edit }} to catch the variable. Since this variable comes in bar-templates.html .