Commit/rollback transaction after rendering response


https://edx-wiki.atlassian.net/browse/LMS-1222

667a1eadb5abd6af589b56911dfdd66664f337dc introduced a database access in every template render which includes navigation.html (if the shopping cart is enabled). Since student.view.confirm_email_change does manual commit and the templates are being rendered after doing a commit or rollback, the render call does a database access which starts a new transaction and a "Transaction managed block ended with pending COMMIT/ROLLBACK" exception. This PR moves the rendering up so that it happens before the transaction rollback/commit.

https://github.com/edx/edx-platform/commit/667a1eadb5abd6af589b56911dfdd66664f337dc#diff-048caae8c14e1173bb610853315c5b7f

@jbau @cpennington, can you review this? I tried to get the existing tests to fail by trying to patch the settings but apparently the templates are not really rendered and so that did not work. If we need tests for this any suggestions?