I want to output 'hello,XXX' (XXX=request.session['user']) at the top every page, so I write the below code in base.html:
hello {{ request.session['user'] }}
and there have TemplateSyntaxError:
Could not parse the remainder: '['user']' from 'request.session['user']'
This is a similar question but I really don't understand: Dynamic variables in Django base.html
If XXX is a function return value, where to write this function and how to render this value?