Fix Mako templates to always use updated request context

Fixed the edX middleware to lazily create request context for Mako templates, so that it is based on any changes made to the request object. 

Without this change, Mako templates for the courseware were rendered with the original user, rather than the user that had been updated by the courseware view. This had two side effects:
1. It defeated the ```prefetch_related``` call for the user's groups so ```has_access``` was not optimized
2. It defeated the preview's masquerade capability, so the Mako template always rendered the staff view, e.g. the "Instructor" tab was not hidden.

Added a Bok Choy test that verifies that the "Instructor" tab is correctly hidden when a staff member is viewing the course as a student.

Reviewers: @cpennington @dmitchell 
FYI: @ormsbee @adampalay @cahrens
This freezes the context at the time of first render, which may just push the bug backwards a little bit. I would expect this call to be relatively inexpensive, and the number of times that we call `render_to_string` to be low, so maybe just always compute a new `RequestContext`?