Fix infinite recursion bug with template loaders that use SQL.

Move the get_template_info stacktrace loop into a utility method.
Check for calls to get_template_context to prevent the infinite recursion.

The bug requires TEMPLATE_DEBUG=True, for the template to extend
another template and SQL to be run in the template loader.
With this configuration the SQL Panel would identify the SQL query
while loading the template, then try to load the template again which
would create a new SQL query ending in an infinite recursion.

Skip the infinite recursion regression test for Django < 1.5

The test is being skipped because Django 1.4 loads the TEMPLATE_LOADERS
before override_settings can modify it. This means that the SQL query
isn't run when loading the template which causes the test to fail.

The other solution would have been to add a conditional setting, but that
could introduce unexpected results in future tests. Skipping this test is
the safer, more conservative approach.

Closes #598.