Avoid creating an empty dictionary into contexts when using render_to_string.
Added some tests for #21741