Repository: explorerhq/sql-explorer (language: python)

Issue:
Preparing localization for all UI messages and russian localization
* Preparing localization for all UI messages («trans», «blocktrans»)
* Add russian localization for all these messages


Discussion / hints:
Impressive @belonesox! Thank you for the contribution, will check this out properly soon. 
@belonesox Could you delete the `.mo` files and add `.mo` to the git ignore please?

They're generated files & typically a generated file isn't committed to git. 
OK, done, but there are different rules for these, and  I follow that
https://github.com/groveco/django-sql-explorer/blob/master/explorer/locale/zh_Hans/LC_MESSAGES/django.mo
included in your git, your ``setup.py`` missed ``compilemessages`` flow, and now for all who would install  ``django-sql-explorer`` from pip russian localization will not work out the box.

@belonesox in my experience, packages don't need to ship with mo files because the Django project using the app will define its supported languages and the person deploying the app runs compile messages which then creates the mo files.

One of the main packages I use in this circumstance being Django allauth.

I can certainly build the command into the release pipeline. That way they'd go into the pip package. 
> packages don't need to ship with mo files

* Every python/django package should contain in WHL file compiled «mo-files». Usually, these files stored on git 
https://github.com/django/django/tree/main/django/contrib/admin/locale/af/LC_MESSAGES

Theoretically, it possible to not store it (I cannot remember a project with such paradigm, just checked almost all my django deps wheels — and cannot find such project), but then ``setup.py`` should:
* have big deps in ``setup_requires`` (big django staff) and provide build flow in ``setup.py`` for building these mo-files.
* of course publish whl-builds in pypi with compiled mo-files.

>because the Django project using the app will define its supported languages,  and the person deploying the app runs compile messages which then creates the mo files.

* compilation «po → mo» (``django_admin compilemessages``) compiles '''all''' available language po-files, it does not depend of locales supported/selected by application.
* If user run ``django_admin compilemessages``, it compiles locale only for user application, not for django applications that use this app.
@belonesox Ah ok, if django stores it's `mo` files in git, then lets keep things consistent & do the same, if you don't mind?

Thanks for providing that extra info!
OK, return "mo" back.
Is something else need to merge this? 
@belonesox I added some comments about the way you've added the translation tags. Feel free to share any thoughts or I could merge & then make changes myself.
>  I added some comments about the way you've added the translation tags

Sorry, I dont see them. There I should read these comments?

Fix patch:
diff --git a/HISTORY.rst b/HISTORY.rst
index 6f005225..0b53fb07 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -8,6 +8,11 @@ This project adheres to `Semantic Versioning <https://semver.org/>`_.
 `unreleased`_ changes
 ---------------------
 
+`2.3.0`_ (2021-07-24)
+---------------------
+* `#450`_: Added Russian translations.
+* `#449`_: Translates expression for duration
+
 `2.2.0`_ (2021-06-14)
 ---------------------
 * Updated docs theme to `furo`_
@@ -329,7 +334,8 @@ Initial Release
 .. _2.1.2: https://github.com/groveco/django-sql-explorer/compare/2.1.1...2.1.2
 .. _2.1.3: https://github.com/groveco/django-sql-explorer/compare/2.1.2...2.1.3
 .. _2.2.0: https://github.com/groveco/django-sql-explorer/compare/2.1.3...2.2.0
-.. _unreleased: https://github.com/groveco/django-sql-explorer/compare/2.2.0...master
+.. _2.3.0: https://github.com/groveco/django-sql-explorer/compare/2.2.0...2.3.0
+.. _unreleased: https://github.com/groveco/django-sql-explorer/compare/2.3.0...master
 
 .. _#254: https://github.com/groveco/django-sql-explorer/pull/254
 .. _#334: https://github.com/groveco/django-sql-explorer/pull/334
@@ -369,6 +375,8 @@ Initial Release
 .. _#442: https://github.com/groveco/django-sql-explorer/pull/442
 .. _#444: https://github.com/groveco/django-sql-explorer/pull/444
 .. _#445: https://github.com/groveco/django-sql-explorer/pull/445
+.. _#449: https://github.com/groveco/django-sql-explorer/pull/449
+.. _#450: https://github.com/groveco/django-sql-explorer/pull/450
 
 .. _#269: https://github.com/groveco/django-sql-explorer/issues/269
 .. _#288: https://github.com/groveco/django-sql-explorer/issues/288
@@ -382,4 +390,4 @@ Initial Release
 .. _#440: https://github.com/groveco/django-sql-explorer/issues/440
 .. _#443: https://github.com/groveco/django-sql-explorer/issues/443
 
-.. _furo: https://github.com/pradyunsg/furo
\ No newline at end of file
+.. _furo: https://github.com/pradyunsg/furo
diff --git a/README.rst b/README.rst
index 08c98652..1a46631b 100644
--- a/README.rst
+++ b/README.rst
@@ -66,3 +66,14 @@ Sql Explorer is MIT licensed, and pull requests are welcome.
 **Snapshot query results to S3 & download as csv**
 
 .. image:: https://s3-us-west-1.amazonaws.com/django-sql-explorer/2019_snapshots.png
+
+
+Alternatives
+------------
+
+* `django-sql-dashboard`_: provides an authenticated interface for executing read-only SQL queries directly against your PostgreSQL database, bringing a useful subset of `Datasette`_ to Django.
+
+
+
+.. _django-sql-dashboard: https://github.com/simonw/django-sql-dashboard
+.. _Datasette : https://datasette.io/
diff --git a/explorer/__init__.py b/explorer/__init__.py
index 100849d8..41ecc3b2 100644
--- a/explorer/__init__.py
+++ b/explorer/__init__.py
@@ -1,6 +1,6 @@
 __version_info__ = {
     'major': 2,
-    'minor': 2,
+    'minor': 3,
     'micro': 0,
     'releaselevel': 'final',
     'serial': 0
diff --git a/explorer/locale/ru/LC_MESSAGES/django.mo b/explorer/locale/ru/LC_MESSAGES/django.mo
index d902a363..ac00d263 100644
Binary files a/explorer/locale/ru/LC_MESSAGES/django.mo and b/explorer/locale/ru/LC_MESSAGES/django.mo differ
diff --git a/explorer/locale/ru/LC_MESSAGES/django.po b/explorer/locale/ru/LC_MESSAGES/django.po
index 40b9e3d5..97baaaa1 100644
--- a/explorer/locale/ru/LC_MESSAGES/django.po
+++ b/explorer/locale/ru/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-07-24 10:26-0500\n"
+"POT-Creation-Date: 2021-07-24 16:19-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -20,8 +20,8 @@ msgstr ""
 "%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n"
 "%100>=11 && n%100<=14)? 2 : 3);\n"
 
-#: explorer/apps.py:10 explorer/templates/explorer/base.html:10
-#: explorer/templates/explorer/base.html:35
+#: explorer/apps.py:10 explorer/templates/explorer/base.html:9
+#: explorer/templates/explorer/base.html:34
 #: explorer/templates/explorer/fullscreen.html:8
 msgid "SQL Explorer"
 msgstr "SQL Навигатор"
@@ -39,8 +39,8 @@ msgstr ""
 "этого запроса.Если не использовать, будет использоваться соединение по "
 "умолчанию"
 
-#: explorer/models.py:60 explorer/templates/explorer/query_list.html:49
-#: explorer/templates/explorer/querylog_list.html:33
+#: explorer/models.py:60 explorer/templates/explorer/query_list.html:22
+#: explorer/templates/explorer/query_list.html:57
 msgid "Query"
 msgstr "Запрос"
 
@@ -48,32 +48,32 @@ msgstr "Запрос"
 msgid "Queries"
 msgstr "Запросы"
 
-#: explorer/templates/explorer/fullscreen.html:16
-#: explorer/templates/explorer/play.html:7
-#: explorer/templates/explorer/query.html:6
-#: explorer/templates/explorer/query.html:16
+#: explorer/templates/explorer/fullscreen.html:20
+#: explorer/templates/explorer/play.html:6
+#: explorer/templates/explorer/query.html:7
+#: explorer/templates/explorer/query.html:26
 #: explorer/templates/explorer/query_list.html:6
 #: explorer/templates/explorer/querylog_list.html:6
 msgid "New Query"
 msgstr "Новый запрос"
 
-#: explorer/templates/explorer/fullscreen.html:39
-#: explorer/templates/explorer/preview_pane.html:81
+#: explorer/templates/explorer/fullscreen.html:46
+#: explorer/templates/explorer/preview_pane.html:106
 msgid "Empty Resultset"
 msgstr "Результат запроса пуст"
 
-#: explorer/templates/explorer/play.html:8
-#: explorer/templates/explorer/play.html:16
-#: explorer/templates/explorer/query.html:7
+#: explorer/templates/explorer/play.html:7
+#: explorer/templates/explorer/play.html:15
+#: explorer/templates/explorer/query.html:9
 #: explorer/templates/explorer/query_list.html:7
 #: explorer/templates/explorer/querylog_list.html:7
 #: explorer/templates/explorer/querylog_list.html:23
-#: explorer/templates/explorer/querylog_list.html:33
+#: explorer/templates/explorer/querylog_list.html:41
 msgid "Playground"
 msgstr "Полигон"
 
-#: explorer/templates/explorer/play.html:9
-#: explorer/templates/explorer/query.html:10
+#: explorer/templates/explorer/play.html:8
+#: explorer/templates/explorer/query.html:14
 #: explorer/templates/explorer/query_list.html:8
 #: explorer/templates/explorer/querylog_list.html:8
 msgid "Logs"
@@ -87,107 +87,115 @@ msgstr ""
 "Полигон предназначен для экспериментов и написания специальных запросов. По "
 "умолчанию тут ничего не будет сохраняться"
 
-#: explorer/templates/explorer/play.html:24
-#: explorer/templates/explorer/query.html:46
+#: explorer/templates/explorer/play.html:27
+#: explorer/templates/explorer/query.html:61
 msgid "Connection"
 msgstr "Соединение"
 
-#: explorer/templates/explorer/play.html:39
+#: explorer/templates/explorer/play.html:42
 msgid "Playground SQL"
 msgstr "Экспериментальный SQL"
 
-#: explorer/templates/explorer/play.html:55
-#: explorer/templates/explorer/query.html:110
+#: explorer/templates/explorer/play.html:62
+#: explorer/templates/explorer/query.html:147
 msgid "Refresh"
 msgstr "Обновить"
 
-#: explorer/templates/explorer/play.html:58
-#: explorer/templates/explorer/play.html:68
-#: explorer/templates/explorer/query.html:98
-#: explorer/templates/explorer/query.html:115
+#: explorer/templates/explorer/play.html:65
+#: explorer/templates/explorer/play.html:77
+#: explorer/templates/explorer/query.html:127
+#: explorer/templates/explorer/query.html:154
 msgid "Toggle Dropdown"
 msgstr "Включить выпадающий список"
 
-#: explorer/templates/explorer/play.html:61
+#: explorer/templates/explorer/play.html:68
 msgid "Save As New Query"
 msgstr "Сохранить как новый запрос"
 
-#: explorer/templates/explorer/play.html:65
-#: explorer/templates/explorer/query.html:112
+#: explorer/templates/explorer/play.html:73
+#: explorer/templates/explorer/query.html:150
 msgid "Download"
 msgstr "Скачать"
 
-#: explorer/templates/explorer/play.html:75
-#: explorer/templates/explorer/query.html:107
+#: explorer/templates/explorer/play.html:85
+#: explorer/templates/explorer/query.html:141
 msgid "Show Schema"
 msgstr "Показать схему базы"
 
-#: explorer/templates/explorer/play.html:76
-#: explorer/templates/explorer/query.html:108
+#: explorer/templates/explorer/play.html:88
+#: explorer/templates/explorer/query.html:144
 msgid "Hide Schema"
 msgstr "Скрыть схему"
 
-#: explorer/templates/explorer/play.html:77
-#: explorer/templates/explorer/query.html:106
+#: explorer/templates/explorer/play.html:91
+#: explorer/templates/explorer/query.html:138
 msgid "Format"
 msgstr "Отформатировать запрос"
 
-#: explorer/templates/explorer/play.html:80
+#: explorer/templates/explorer/play.html:95
 msgid "Playground Query"
 msgstr "Экспериментальный запрос"
 
-#: explorer/templates/explorer/preview_pane.html:8
+#: explorer/templates/explorer/preview_pane.html:10
 msgid "Preview"
 msgstr "Предпросмотр"
 
-#: explorer/templates/explorer/preview_pane.html:9
+#: explorer/templates/explorer/preview_pane.html:16
 msgid "Snapshots"
 msgstr "Варианты"
 
-#: explorer/templates/explorer/preview_pane.html:10
-#: explorer/templates/explorer/preview_pane.html:112
+#: explorer/templates/explorer/preview_pane.html:23
+#: explorer/templates/explorer/preview_pane.html:139
 msgid "Pivot"
 msgstr "Сводная таблица"
 
-#: explorer/templates/explorer/preview_pane.html:19
+#: explorer/templates/explorer/preview_pane.html:38
 #, python-format
 msgid "Execution time: %(duration)s ms"
 msgstr "Время выполнения: %(duration)s мс"
 
-#: explorer/templates/explorer/preview_pane.html:28
+#: explorer/templates/explorer/preview_pane.html:46
+msgid "Showing"
+msgstr "Отображение"
+
+#: explorer/templates/explorer/preview_pane.html:48
+msgid "First"
+msgstr "Первый"
+
+#: explorer/templates/explorer/preview_pane.html:50
 #, python-format
 msgid "of %(total_rows)s total rows."
 msgstr "из %(total_rows)s выбранных записей."
 
-#: explorer/templates/explorer/query.html:9
+#: explorer/templates/explorer/query.html:12
 msgid "Query Detail"
 msgstr "Подробности запроса"
 
-#: explorer/templates/explorer/query.html:19
+#: explorer/templates/explorer/query.html:33
 msgid "History"
 msgstr "История"
 
-#: explorer/templates/explorer/query.html:39
+#: explorer/templates/explorer/query.html:54
 msgid "Title"
 msgstr "Название"
 
-#: explorer/templates/explorer/query.html:61
+#: explorer/templates/explorer/query.html:77
 msgid "Description"
 msgstr "Описание"
 
-#: explorer/templates/explorer/query.html:95
+#: explorer/templates/explorer/query.html:124
 msgid "Save & Run"
 msgstr "Сохранить и запустить"
 
-#: explorer/templates/explorer/query.html:103
+#: explorer/templates/explorer/query.html:133
 msgid "Save Only"
 msgstr "Сохранить"
 
-#: explorer/templates/explorer/query.html:136
+#: explorer/templates/explorer/query.html:176
 msgid "Snapshot"
 msgstr "Вариант"
 
-#: explorer/templates/explorer/query.html:142
+#: explorer/templates/explorer/query.html:182
 #, python-format
 msgid ""
 "Avg. execution: %(avg_duration|floatformat:2)sms. Query created by "
@@ -196,54 +204,54 @@ msgstr ""
 "Среднее время выполнения: %(avg_duration|floatformat:2)s мс. Запрос в "
 "%(created)s. от «%(user_email)s»"
 
-#: explorer/templates/explorer/query_confirm_delete.html:6
+#: explorer/templates/explorer/query_confirm_delete.html:7
 #, python-format
-msgid "Are you sure you want to delete \"%(title)s\" ?"
+msgid "Are you sure you want to delete \"%(title)s\"?"
 msgstr "Вы уверены в удалении «%(title)s»?"
 
-#: explorer/templates/explorer/query_list.html:14
+#: explorer/templates/explorer/query_list.html:15
 #, python-format
-msgid " Your %(qlen)s Most Recently Run "
-msgstr " Ваши последние запуски запросов, их %(qlen)s"
+msgid "Your %(qlen)s Most Recently Run"
+msgstr "Ваши последние запуски запросов, их %(qlen)s"
 
-#: explorer/templates/explorer/query_list.html:19
+#: explorer/templates/explorer/query_list.html:23
 msgid "Last Run"
 msgstr "Последний запуск"
 
-#: explorer/templates/explorer/query_list.html:40
+#: explorer/templates/explorer/query_list.html:48
 msgid "All Queries"
 msgstr "Все запросы"
 
-#: explorer/templates/explorer/query_list.html:43
+#: explorer/templates/explorer/query_list.html:51
 #: explorer/templates/explorer/schema.html:10
 msgid "Search"
 msgstr "Поиск"
 
-#: explorer/templates/explorer/query_list.html:50
+#: explorer/templates/explorer/query_list.html:58
 msgid "Created"
 msgstr "Создан"
 
-#: explorer/templates/explorer/query_list.html:52
+#: explorer/templates/explorer/query_list.html:60
 msgid "Email"
 msgstr "Емейл"
 
-#: explorer/templates/explorer/query_list.html:54
+#: explorer/templates/explorer/query_list.html:62
 msgid "CSV"
 msgstr "CSV"
 
-#: explorer/templates/explorer/query_list.html:56
+#: explorer/templates/explorer/query_list.html:64
 msgid "Play"
 msgstr "Запустить"
 
-#: explorer/templates/explorer/query_list.html:57
+#: explorer/templates/explorer/query_list.html:65
 msgid "Delete"
 msgstr "Удалить"
 
-#: explorer/templates/explorer/query_list.html:59
+#: explorer/templates/explorer/query_list.html:67
 msgid "Run Count"
 msgstr "Число запусков"
 
-#: explorer/templates/explorer/query_list.html:79
+#: explorer/templates/explorer/query_list.html:87
 #, python-format
 msgid "by %(cuser)s"
 msgstr " пользователем «%(cuser)s»"
@@ -265,19 +273,20 @@ msgstr "Запущено пользователем"
 msgid "Duration"
 msgstr "Длительность"
 
-#: explorer/templates/explorer/querylog_list.html:21
-msgid "SQL"
-msgstr "SQL"
-
 #: explorer/templates/explorer/querylog_list.html:22
 msgid "Query ID"
 msgstr "ID запроса"
 
-#: explorer/templates/explorer/querylog_list.html:34
+#: explorer/templates/explorer/querylog_list.html:36
+#, python-format
+msgid "Query %(query_id)s"
+msgstr "пользователем «%(query_id)s»"
+
+#: explorer/templates/explorer/querylog_list.html:48
 msgid "Open"
 msgstr "Открыть"
 
-#: explorer/templates/explorer/querylog_list.html:47
+#: explorer/templates/explorer/querylog_list.html:63
 #, python-format
 msgid "Page %(pnum)s of %(anum)s."
 msgstr "Страница %(pnum)s из %(anum)s."
@@ -286,19 +295,19 @@ msgstr "Страница %(pnum)s из %(anum)s."
 msgid "Schema"
 msgstr "Схема"
 
-#: explorer/templates/explorer/schema.html:14
+#: explorer/templates/explorer/schema.html:15
 msgid "Collapse All"
 msgstr "Свернуть все"
 
-#: explorer/templates/explorer/schema.html:17
+#: explorer/templates/explorer/schema.html:20
 msgid "Expand All"
 msgstr "Развернуть все"
 
-#: explorer/templates/explorer/schema_building.html:7
+#: explorer/templates/explorer/schema_building.html:6
 msgid "Schema is building..."
 msgstr "Строится схема…"
 
-#: explorer/templates/explorer/schema_building.html:8
+#: explorer/templates/explorer/schema_building.html:7
 msgid "Please wait a minute, and refresh."
 msgstr "Подождите минутку и обновите."
 
@@ -306,6 +315,9 @@ msgstr "Подождите минутку и обновите."
 msgid "Query saved."
 msgstr "Запрос сохранен."
 
+#~ msgid "SQL"
+#~ msgstr "SQL"
+
 #~ msgid "Avg. execution:"
 #~ msgstr "Среднее время запроса"
 
diff --git a/explorer/templates/explorer/base.html b/explorer/templates/explorer/base.html
index 29f6bebd..161f6ae5 100644
--- a/explorer/templates/explorer/base.html
+++ b/explorer/templates/explorer/base.html
@@ -2,7 +2,6 @@
 
 <!DOCTYPE html>
 <html>
-
 <head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -30,34 +29,34 @@
     <div id="wrap" class="wrap">
         {% block sql_explorer_navbar %}
             <div class="navbar navbar-default navbar-static-top" role="navigation">
-              <div class="container">
-                <div class="navbar-header">
-                    <a class="navbar-brand" href="{% url 'explorer_index' %}">{% trans "SQL Explorer" %}</a>
-                </div>
-                <div class="navbar-collapse collapse">
-                  <ul class="nav navbar-nav">
-                    {% block sql_explorer_navlinks %}{% endblock %}
-                  </ul>
+                <div class="container">
+                    <div class="navbar-header">
+                        <a class="navbar-brand" href="{% url 'explorer_index' %}">{% trans "SQL Explorer" %}</a>
+                    </div>
+                    <div class="navbar-collapse collapse">
+                        <ul class="nav navbar-nav">
+                            {% block sql_explorer_navlinks %}{% endblock %}
+                        </ul>
+                    </div>
                 </div>
-              </div>
             </div>
         {% endblock %}
         <div class="container">
-          <div class="starter-template">
-          {% block sql_explorer_content %}{% endblock %}
-          </div>
+            <div class="starter-template">
+                {% block sql_explorer_content %}{% endblock %}
+            </div>
         </div>
     </div>
   {% endblock %}
     {% block sql_explorer_footer %}
         <div class="container">
             <div class="row">
-              <div class="col-md-12 text-center">
+                <div class="col-md-12 text-center">
                     <p class="text-muted">
                         Powered by <a href="https://www.github.com/groveco/django-sql-explorer/">django-sql-explorer</a> from
                         <a href="https://www.grove.co">Grove Collaborative</a>. Rendered at {% now "SHORT_DATETIME_FORMAT" %}
                     </p>
-              </div>
+                </div>
             </div>
         </div>
     {% endblock %}
diff --git a/explorer/templates/explorer/export_buttons.html b/explorer/templates/explorer/export_buttons.html
index a7fd7a37..1a49d8fa 100644
--- a/explorer/templates/explorer/export_buttons.html
+++ b/explorer/templates/explorer/export_buttons.html
@@ -1,9 +1,9 @@
 {% for key, name in exporters %}
     {% if query and query.id %}
         {% if query.params %}
-          <li><a href="{% url 'download_query' query.id %}?format={{ key }}&params={{ query.params_for_url }}">{{ name }}</a></li>
+            <li><a href="{% url 'download_query' query.id %}?format={{ key }}&params={{ query.params_for_url }}">{{ name }}</a></li>
         {% else %}
-          <li><a href="{% url 'download_query' query.id %}?format={{ key }}">{{ name }}</a></li>
+            <li><a href="{% url 'download_query' query.id %}?format={{ key }}">{{ name }}</a></li>
         {% endif %}
     {% else %}
         <li><input type="submit" value="{{ name }}" data-format="{{ key }}" class="download-button btn btn-link" /></li>
diff --git a/explorer/templates/explorer/fullscreen.html b/explorer/templates/explorer/fullscreen.html
index 6e3c5572..2d50b43e 100644
--- a/explorer/templates/explorer/fullscreen.html
+++ b/explorer/templates/explorer/fullscreen.html
@@ -1,4 +1,4 @@
-{% load static i18n %}
+{% load i18n static %}
 <!DOCTYPE html>
 <html>
 <head>
@@ -9,36 +9,43 @@
 
     <link rel="stylesheet" href="{% static 'explorer/css/bootstrap.min.css' %}" />
     <link rel="stylesheet" href="{% static 'explorer/css/explorer.css' %}" />
-
 </head>
 
 <body>
-  <h2>{% if query %}{{ query.title }}{% if shared %}<small>&nbsp;&nbsp;shared</small>{% endif %}{% else %}{% trans "New Query" %}{% endif %}</h2>
-  <table class="table table-striped">
-    <thead>
-      <tr>
-        {% for h in headers %}
-          <th>{{ h }}</th>
-        {% endfor %}
-      </tr>
-    </thead>
-    <tbody class="list">
-      {% if data %}
-        {% for row in data %}
-          <tr class="data-row">
-            {% for i in row %}
-              {% if unsafe_rendering %}
-                <td>{% autoescape off %}{{ i }}{% endautoescape %}</td>
-              {% else %}
-                <td>{{ i }}</td>
-              {% endif %}
-            {% endfor %}
-          </tr>
-        {% endfor %}
+{% spaceless %}
+  <h2>
+      {% if query %}
+          {{ query.title }}{% if shared %}<small>&nbsp;&nbsp;shared</small>{% endif %}
       {% else %}
-        <tr class="text-center"><td colspan="{{ headers|length }}">{% trans "Empty Resultset" %}</td></tr>
+          {% trans "New Query" %}
       {% endif %}
-    </tbody>
+  </h2>
+{% endspaceless %}
+  <table class="table table-striped">
+      <thead>
+          <tr>
+              {% for h in headers %}
+                  <th>{{ h }}</th>
+              {% endfor %}
+          </tr>
+      </thead>
+      <tbody class="list">
+          {% if data %}
+              {% for row in data %}
+                  <tr class="data-row">
+                      {% for i in row %}
+                          {% if unsafe_rendering %}
+                              <td>{% autoescape off %}{{ i }}{% endautoescape %}</td>
+                          {% else %}
+                              <td>{{ i }}</td>
+                          {% endif %}
+                      {% endfor %}
+                  </tr>
+              {% endfor %}
+          {% else %}
+              <tr class="text-center"><td colspan="{{ headers|length }}">{% trans "Empty Resultset" %}</td></tr>
+          {% endif %}
+      </tbody>
   </table>
 </body>
 </html>
diff --git a/explorer/templates/explorer/params.html b/explorer/templates/explorer/params.html
index 17d8cfd1..8be655a1 100644
--- a/explorer/templates/explorer/params.html
+++ b/explorer/templates/explorer/params.html
@@ -1,15 +1,15 @@
 {% if params %}
 <div class="panel-footer">
-  <div class="form-inline">
-  {% for k, v in params.items %}
-      <div class="form-group">
-          <label for="{{ k }}_param" class="control-label col-sm-4">{{ k }}:</label>
-          <div class="col-sm-7">
-              <input type="text" data-param="{{ k }}" class="param form-control" name="{{ k }}_param" id="{{ k }}_param" placeholder="parameter" value="{{ v }}" />
-          </div>
-          <div class="col-sm-1"></div>
-      </div>
-  {% endfor %}
-  </div>
+    <div class="form-inline">
+        {% for k, v in params.items %}
+            <div class="form-group">
+                <label for="{{ k }}_param" class="control-label col-sm-4">{{ k }}:</label>
+                <div class="col-sm-7">
+                    <input type="text" data-param="{{ k }}" class="param form-control" name="{{ k }}_param" id="{{ k }}_param" placeholder="parameter" value="{{ v }}" />
+                </div>
+                <div class="col-sm-1"></div>
+            </div>
+        {% endfor %}
+    </div>
 </div>
 {% endif %}
diff --git a/explorer/templates/explorer/play.html b/explorer/templates/explorer/play.html
index 55fc6f61..f260f951 100644
--- a/explorer/templates/explorer/play.html
+++ b/explorer/templates/explorer/play.html
@@ -1,12 +1,11 @@
 {% extends "explorer/base.html" %}
-
 {% load explorer_tags i18n %}
 
 {% block sql_explorer_navlinks %}
     {% if can_change %}
-      <li><a href="{% url 'query_create' %}">{% trans "New Query" %}</a></li>
-      <li class="active"><a href="">{% trans "Playground" %}</a></li>
-      <li><a href="{% url 'explorer_logs' %}">{% trans "Logs" %}</a></li>
+        <li><a href="{% url 'query_create' %}">{% trans "New Query" %}</a></li>
+        <li class="active"><a href="">{% trans "Playground" %}</a></li>
+        <li><a href="{% url 'explorer_logs' %}">{% trans "Logs" %}</a></li>
     {% endif %}
 {% endblock %}
 
@@ -14,36 +13,44 @@
 <div class="row">
     <div id="query_area" class="col-md-12">
         <h2>{% trans "Playground" %}</h2>
-        <p>{% trans "The playground is for experimenting and writing ad-hoc queries. By default, nothing you do here will be saved." %}</p>
+        <p>
+            {% blocktrans trimmed %}
+                The playground is for experimenting and writing ad-hoc queries. By default, nothing you do here will be saved.
+            {% endblocktrans %}
+        </p>
         <form role="form" action="{% url 'explorer_playground' %}" method="post" id="editor" class="playground-form form-horizontal">{% csrf_token %}
             {% if error %}
                 <div class="alert alert-danger">{{ error|escape }}</div>
             {% endif %}
             {% if form.connections|length > 1 %}
-              <div class="form-group">
-                <label for="id_connection" class="col-sm-2 control-label">{% trans "Connection" %}</label>
-                <div class="col-sm-10">
-                  {{ form.connection }}
+                <div class="form-group">
+                    <label for="id_connection" class="col-sm-2 control-label">{% trans "Connection" %}</label>
+                    <div class="col-sm-10">
+                        {{ form.connection }}
+                    </div>
                 </div>
-              </div>
             {% else %}
-              {# still need to submit the connection, just hide the UI element #}
-              <div class="hidden">
-                {{ form.connection }}
-              </div>
+                {# still need to submit the connection, just hide the UI element #}
+                <div class="hidden">
+                    {{ form.connection }}
+                </div>
             {% endif %}
             <div class="panel panel-default sql-panel">
                 <div class="panel-heading">
-                  <div class="row">
-                    <div class="col-md-6">
-                      <span class="panel-title">{% trans "Playground SQL" %}</span>
-                    </div>
-                    {% if ql_id %}
-                        <div class="col-md-6 text-right">
-                          <small><a href="{% url 'explorer_playground' %}?querylog_id={{ ql_id }}"><i class="glyphicon glyphicon-link"></i></a></small>
+                    <div class="row">
+                        <div class="col-md-6">
+                            <span class="panel-title">{% trans "Playground SQL" %}</span>
                         </div>
-                    {% endif %}
-                  </div>
+                        {% if ql_id %}
+                            <div class="col-md-6 text-right">
+                                <small>
+                                    <a href="{% url 'explorer_playground' %}?querylog_id={{ ql_id }}">
+                                        <i class="glyphicon glyphicon-link"></i>
+                                    </a>
+                                </small>
+                            </div>
+                        {% endif %}
+                    </div>
                 </div>
                 <div class="panel-content">
                     <textarea class="form-control" cols="40" id="id_sql" name="sql" rows="20">{{ query.sql }}</textarea>
@@ -51,30 +58,38 @@ <h2>{% trans "Playground" %}</h2>
             </div>
             <div class="form-group">
                 <div class="text-center">
-                  <div class="btn-group">
-                    <input type="submit" value="{% trans 'Refresh' %}" id="refresh_play_button" class="btn btn-default"/>
-                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                      <span class="caret"></span>
-                      <span class="sr-only">{% trans "Toggle Dropdown" %}</span>
+                    <div class="btn-group">
+                        <input type="submit" value="{% trans 'Refresh' %}" id="refresh_play_button" class="btn btn-default"/>
+                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                            <span class="caret"></span>
+                            <span class="sr-only">{% trans "Toggle Dropdown" %}</span>
+                        </button>
+                        <ul class="dropdown-menu">
+                            <li><input type="submit" value="{% trans 'Save As New Query' %}" id="create_button" class="btn btn-link"/></li>
+                        </ul>
+                    </div>
+                    <div class="btn-group">
+                        <label class="btn btn-default" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                            {% trans "Download" %}
+                        </label>
+                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                            <span class="caret"></span>
+                            <span class="sr-only">{% trans "Toggle Dropdown" %}</span>
+                        </button>
+                        <ul class="dropdown-menu">
+                            {% export_buttons query %}
+                        </ul>
+                    </div>
+
+                    <button type="button" class="btn btn-default" id="show_schema_button">
+                        {% trans "Show Schema" %}
                     </button>
-                    <ul class="dropdown-menu">
-                      <li><input type="submit" value="{% trans 'Save As New Query' %}" id="create_button" class="btn btn-link"/></li>
-                    </ul>
-                  </div>
-                  <div class="btn-group">
-                    <label class="btn btn-default" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{% trans "Download" %}</label>
-                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                      <span class="caret"></span>
-                      <span class="sr-only">{% trans "Toggle Dropdown" %}</span>
+                    <button type="button" class="btn btn-default" id="hide_schema_button" style="display: none;">
+                        {% trans "Hide Schema" %}
+                    </button>
+                    <button type="button" class="btn btn-default" id="format_button">
+                        {% trans "Format" %}
                     </button>
-                    <ul class="dropdown-menu">
-                      {% export_buttons query %}
-                    </ul>
-                  </div>
-
-                  <button type="button" class="btn btn-default" id="show_schema_button">{% trans "Show Schema" %}</button>
-                  <button type="button" class="btn btn-default" id="hide_schema_button" style="display: none;">{% trans "Hide Schema" %}</button>
-                  <button type="button" class="btn btn-default" id="format_button">{% trans "Format" %}</button>
                 </div>
             </div>
             <input type="hidden" value="{% trans 'Playground Query' %}" name="title" />
diff --git a/explorer/templates/explorer/preview_pane.html b/explorer/templates/explorer/preview_pane.html
index 3bfb6b23..b7496fea 100644
--- a/explorer/templates/explorer/preview_pane.html
+++ b/explorer/templates/explorer/preview_pane.html
@@ -5,37 +5,59 @@
         <div class="col-md-12">
             <div role="tabpanel">
                 <ul class="nav nav-tabs" role="tablist">
-                    <li role="presentation" class="active"><a href="#previewpane" aria-controls="previewpane" role="tab" data-toggle="tab" id="preview-tab-label">{% trans "Preview" %}</a></li>
-                    {% if query.id and query.snapshot %}<li role="presentation"><a href="#snapshots" aria-controls="snapshots" role="tab" data-toggle="tab">{% trans "Snapshots" %}</a></li>{% endif %}
-                    {% if data %}<li role="presentation"><a href="#pivot" aria-controls="pivot" role="tab" data-toggle="tab" id="pivot-tab-label">{% trans "Pivot" %}</a></li>{% endif %}
+                    <li role="presentation" class="active">
+                        <a id="preview-tab-label" href="#previewpane" aria-controls="previewpane" role="tab" data-toggle="tab">
+                            {% trans "Preview" %}
+                        </a>
+                    </li>
+                    {% if query.id and query.snapshot %}
+                        <li role="presentation">
+                            <a href="#snapshots" aria-controls="snapshots" role="tab" data-toggle="tab">
+                                {% trans "Snapshots" %}
+                            </a>
+                        </li>
+                    {% endif %}
+                    {% if data %}
+                        <li role="presentation">
+                            <a id="pivot-tab-label" href="#pivot" aria-controls="pivot" role="tab" data-toggle="tab">
+                                {% trans "Pivot" %}
+                            </a>
+                        </li>
+                    {% endif %}
                 </ul>
                 <div class="tab-content">
                     <div role="tabpanel" class="tab-pane active" id="previewpane">
                         <div class="panel panel-default">
                             <div class="panel-heading">
-                              <div class="row">
-                                <div class="col-md-6">
-                                  {% if data %}<a title="Show row numbers" id="counter-toggle" href="#">#</a>&nbsp;{% endif %}
-                                  <span class="panel-title">{% blocktrans with duration=duration|floatformat:2 %}Execution time: {{ duration }} ms{% endblocktrans %}</span>
-                                </div>
-                                <div class="col-md-6 text-right">
-                                  <span class="row-control">
-                                      {% if rows > total_rows %}
-                                          {% trans Showing %}<input class="rows-input" type="text" name="rows" id="rows" value="{{ total_rows }}" />
-                                      {% else %}
-                                          {% trans First %}<input class="rows-input" type="text" name="rows" id="rows" value="{{ rows }}" />
-                                      {% endif %}
-                                      {% blocktrans %}of {{ total_rows }} total rows.{% endblocktrans %}
-                                  </span>
-                                  <span>
-                                    <small>
-                                      <a id="fullscreen" href="./?{{ fullscreen_params }}" target="_blank" title="Fullscreen results">
-                                        <i class="glyphicon glyphicon-resize-full"></i>
-                                      </a>
-                                    </small>
-                                  </span>
+                                <div class="row">
+                                    <div class="col-md-6">
+                                        {% if data %}
+                                            <a title="Show row numbers" id="counter-toggle" href="#">#</a>&nbsp
+                                        {% endif %}
+                                        <span class="panel-title">
+                                            {% blocktrans trimmed with duration=duration|floatformat:2 %}
+                                                Execution time: {{ duration }} ms
+                                            {% endblocktrans %}
+                                        </span>
+                                    </div>
+                                    <div class="col-md-6 text-right">
+                                        <span class="row-control">
+                                            {% if rows > total_rows %}
+                                                {% trans "Showing" %}&nbsp;<input class="rows-input" type="text" name="rows" id="rows" value="{{ total_rows }}" />
+                                            {% else %}
+                                                {% trans "First" %}&nbsp;<input class="rows-input" type="text" name="rows" id="rows" value="{{ rows }}" />
+                                            {% endif %}
+                                            {% blocktrans %}of {{ total_rows }} total rows.{% endblocktrans %}
+                                        </span>
+                                        <span>
+                                            <small>
+                                                <a id="fullscreen" href="./?{{ fullscreen_params }}" target="_blank" title="Fullscreen results">
+                                                    <i class="glyphicon glyphicon-resize-full"></i>
+                                                </a>
+                                            </small>
+                                        </span>
+                                    </div>
                                 </div>
-                              </div>
                             </div>
                             <div class="overflow-wrapper">
                                 <table class="table table-striped table-hover" id="preview">
@@ -47,38 +69,43 @@
                                             {% endfor %}
                                         </tr>
                                         <tr class="stats-th">
-                                          <th class="counter"></th>
-                                          {% for h in headers %}
-                                          <th>
-                                            {% if h.summary %}
-                                              <i class="stats-expand glyphicon glyphicon-education"></i>
-                                              <div class="stats-wrapper">
-                                                  {% for label, value in h.summary.stats.items %}
-                                                      <div class="stat-wrapper"><span class="stat-label">{{ label }}:&nbsp;</span><span class="stat-value">{{ value }}</span></div>
-                                                  {% endfor %}
-                                              </div>
-                                            {% endif %}
-                                          </th>
-                                          {% endfor %}
+                                            <th class="counter"></th>
+                                            {% for h in headers %}
+                                                <th>
+                                                    {% if h.summary %}
+                                                        <i class="stats-expand glyphicon glyphicon-education"></i>
+                                                        <div class="stats-wrapper">
+                                                            {% for label, value in h.summary.stats.items %}
+                                                                <div class="stat-wrapper"><span class="stat-label">{{ label }}:&nbsp;</span><span class="stat-value">{{ value }}</span></div>
+                                                            {% endfor %}
+                                                        </div>
+                                                    {% endif %}
+                                                </th>
+                                            {% endfor %}
                                         </tr>
-
                                     </thead>
                                     <tbody class="list">
                                         {% if data %}
                                             {% for row in data %}
-                                            <tr class="data-row">
-                                              <td class="counter">{{ forloop.counter0 }}</td>
-                                                {% for i in row %}
-                                                  {% if unsafe_rendering %}
-                                                    <td class="{{ forloop.counter0 }}">{% autoescape off %}{{ i }}{% endautoescape %}</td>
-                                                  {% else %}
-                                                    <td class="{{ forloop.counter0 }}">{{ i }}</td>
-                                                  {% endif %}
-                                                {% endfor %}
-                                            </tr>
+                                                <tr class="data-row">
+                                                    <td class="counter">{{ forloop.counter0 }}</td>
+                                                    {% for i in row %}
+                                                        {% if unsafe_rendering %}
+                                                            <td class="{{ forloop.counter0 }}">
+                                                                {% autoescape off %}{{ i }}{% endautoescape %}
+                                                            </td>
+                                                        {% else %}
+                                                            <td class="{{ forloop.counter0 }}">{{ i }}</td>
+                                                        {% endif %}
+                                                    {% endfor %}
+                                                </tr>
                                             {% endfor %}
                                         {% else %}
-                                            <tr class="text-center"><td colspan="{{ headers|length }}">{% blocktrans %}Empty Resultset{% endblocktrans %}</td></tr>
+                                            <tr class="text-center">
+                                                <td colspan="{{ headers|length }}">
+                                                    {% trans "Empty Resultset" %}
+                                                </td>
+                                            </tr>
                                         {% endif %}
                                     </tbody>
                                 </table>
@@ -92,36 +119,40 @@
                                     <span class="panel-title">{{ snapshots|length }} Snapshots <small>(oldest first)</small></span>
                                 </div>
                                 <div class="overflow-wrapper">
-                                <p>
-                                    <ul>
-                                    {%  for s in snapshots %}
-                                        <li><a href='{{ s.url }}'>{{ s.last_modified }}</a></li>
-                                    {% endfor %}
-                                    </ul>
-                                </p>
+                                    <p>
+                                        <ul>
+                                        {%  for s in snapshots %}
+                                            <li><a href='{{ s.url }}'>{{ s.last_modified }}</a></li>
+                                        {% endfor %}
+                                        </ul>
+                                    </p>
                                 </div>
                             </div>
                         </div>
                     {% endif %}
                     {% if data %}
-                      <div role="tabpanel" class="tab-pane" id="pivot">
-                        <div class="panel panel-default">
-                          <div class="panel-heading">
-                            <div class="row">
-                              <div class="col-md-6">
-                                <span class="panel-title">{% blocktrans %}Pivot{% endblocktrans %}</span>
-                              </div>
-                              <div class="col-md-6 text-right">
-                                <small><a id="pivot-bookmark" data-baseurl="{% url 'explorer_playground' %}?querylog_id={{ ql_id }}" href="#"><i class="glyphicon glyphicon-link"></i></a></small>
-                              </div>
+                        <div role="tabpanel" class="tab-pane" id="pivot">
+                            <div class="panel panel-default">
+                                <div class="panel-heading">
+                                    <div class="row">
+                                        <div class="col-md-6">
+                                            <span class="panel-title">{% trans "Pivot" %}</span>
+                                        </div>
+                                        <div class="col-md-6 text-right">
+                                            <small>
+                                                <a id="pivot-bookmark" data-baseurl="{% url 'explorer_playground' %}?querylog_id={{ ql_id }}" href="#">
+                                                    <i class="glyphicon glyphicon-link"></i>
+                                                </a>
+                                            </small>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="overflow-wrapper">
+                                    <div class="pivot-table"></div>
+                                </div>
                             </div>
-                          </div>
-                          <div class="overflow-wrapper">
-                            <div class="pivot-table"></div>
-                          </div>
                         </div>
-                      </div>
-                  {% endif %}
+                    {% endif %}
                 </div>
             </div>
         </div>
diff --git a/explorer/templates/explorer/query.html b/explorer/templates/explorer/query.html
index 090f17a3..974ff18b 100644
--- a/explorer/templates/explorer/query.html
+++ b/explorer/templates/explorer/query.html
@@ -3,20 +3,35 @@
 
 {% block sql_explorer_navlinks %}
     {% if can_change %}
-    <li{% if not query %} class="active" {% endif %}><a href="{% url 'query_create' %}">{% trans "New Query" %}</a></li>
-    <li><a href="{% url 'explorer_playground' %}">{% trans "Playground" %}</a></li>
+        <li{% if not query %} class="active" {% endif %}>
+            <a href="{% url 'query_create' %}">{% trans "New Query" %}</a>
+        </li>
+        <li><a href="{% url 'explorer_playground' %}">{% trans "Playground" %}</a></li>
+    {% endif %}
+    {% if query %}
+        <li class="active"><a href="">{% trans "Query Detail" %}</a></li>
     {% endif %}
-    {% if query %}<li class="active"><a href="">{% trans "Query Detail" %}</a></li>{% endif %}
     <li><a href="{% url 'explorer_logs' %}">{% trans "Logs" %}</a></li>
 {% endblock %}
 
 {% block sql_explorer_content %}
 <div class="row">
     <div id="query_area" class="query-area col-md-12">
-        <h2>{% if query %}{{ query.title }}{% if shared %}<small>&nbsp;&nbsp;shared</small>{% endif %}{% else %}{% trans "New Query" %}{% endif %}</h2>
+        {% spaceless %}
+            <h2>
+                {% if query %}
+                    {{ query.title }}
+                    {% if shared %}<small>&nbsp;&nbsp;shared</small>{% endif %}
+                {% else %}
+                    {% trans "New Query" %}
+                {% endif %}
+            </h2>
+        {% endspaceless %}
         {% if query %}
             <div class="text-right">
-                <a href="{% url 'explorer_logs' %}?query_id={{ query.id }}"><h2 class="small">{% trans "History" %}</h2></a>
+                <a href="{% url 'explorer_logs' %}?query_id={{ query.id }}">
+                    <h2 class="small">{% trans "History" %}</h2>
+                </a>
             </div>
         {% endif %}
         {% if message %}
@@ -36,92 +51,115 @@ <h2>{% if query %}{{ query.title }}{% if shared %}<small>&nbsp;&nbsp;shared</sma
                     {% if form.title.errors %}{% for error in form.title.errors %}
                         <div class="alert alert-danger">{{ error|escape }}</div>
                     {% endfor %}{% endif %}
-                    <label for="id_title" class="col-sm-2 control-label">{% blocktrans %}Title{% endblocktrans %}</label>
+                    <label for="id_title" class="col-sm-2 control-label">{% trans "Title" %}</label>
                     <div class="col-sm-10">
                         <input class="form-control" id="id_title" maxlength="255" name="title" type="text" {% if not can_change %}disabled{% endif %} value="{{ form.title.value|default_if_none:"" }}" />
                     </div>
-                  {% if form.connections|length > 1 and can_change %}
-                    </div>
-                    <div class="form-group">
-                      <label for="id_connection" class="col-sm-2 control-label">{% trans "Connection" %}</label>
-                      <div class="col-sm-10">
+                {% if form.connections|length > 1 and can_change %}
+                </div>
+                <div class="form-group">
+                    <label for="id_connection" class="col-sm-2 control-label">{% trans "Connection" %}</label>
+                    <div class="col-sm-10">
                         {{ form.connection }}
-                      </div>
-                  {% else %}
+                    </div>
+                {% else %}
                     {# still need to submit the connection, just hide the UI element #}
                     <div class="hidden">
                       {{ form.connection }}
                     </div>
-                  {% endif %}
+                {% endif %}
                 </div>
                 <div class="form-group">
                     {% if form.description.errors %}
                         <div class="alert alert-danger">{{ form.description.errors }}</div>
                     {% endif %}
-                    <label for="id_description" class="col-sm-2 control-label">{% trans "Description"%}</label>
+                    <label for="id_description" class="col-sm-2 control-label">
+                        {% trans "Description"%}
+                    </label>
                     <div class="col-sm-10">
-                        <textarea class="form-control" cols="40" id="id_description" name="description" {% if not can_change %}disabled{% endif %} rows="2">{{ form.description.value|default_if_none:"" }}</textarea>
+                        <textarea id="id_description" class="form-control" cols="40" name="description" {% if not can_change %}disabled{% endif %} rows="2">
+                            {{ form.description.value|default_if_none:"" }}
+                        </textarea>
                     </div>
                 </div>
                 <input type="hidden" id="id_created_by_user" name="created_by_user" value="{{ form.created_by_user_email }}" />
-                {% if form.sql.errors %}{% for error in form.sql.errors %}
-                    <div class="alert alert-danger">{{ error|escape }}</div>
-                {% endfor %}{% endif %}
+                {% if form.sql.errors %}
+                    {% for error in form.sql.errors %}
+                        <div class="alert alert-danger">{{ error|escape }}</div>
+                    {% endfor %}
+                {% endif %}
                 <div class="panel panel-default sql-panel">
                     <div class="panel-heading">
-                      <div class="row">
-                        <div class="col-md-6">
-                          <span class="panel-title">SQL</span>
-                        </div>
-                        <div class="col-md-6 text-right">
-                          {% if query %}
-                              <small><a href="#" title="Open in playground" id="playground_button"><i class="glyphicon glyphicon-new-window"></i></a></small>
-                              <small><i id="sql_toggle" class="glyphicon glyphicon-resize-full"></i></small>
-                          {% endif %}
+                        <div class="row">
+                            <div class="col-md-6">
+                                <span class="panel-title">SQL</span>
+                            </div>
+                            <div class="col-md-6 text-right">
+                                {% if query %}
+                                    <small>
+                                        <a href="#" title="Open in playground" id="playground_button">
+                                            <i class="glyphicon glyphicon-new-window"></i>
+                                        </a>
+                                    </small>
+                                    <small>
+                                        <i id="sql_toggle" class="glyphicon glyphicon-resize-full"></i>
+                                    </small>
+                                {% endif %}
+                            </div>
                         </div>
-                      </div>
                     </div>
                     <div class="panel-content">
-                        <textarea class="form-control" {% if not can_change %} disabled {% endif %} cols="40" id="id_sql" name="sql" rows="20">{{ form.sql.value|default_if_none:"" }}</textarea>
+                        <textarea class="form-control" {% if not can_change %} disabled {% endif %} cols="40" id="id_sql" name="sql" rows="20">
+                            {{ form.sql.value|default_if_none:"" }}
+                        </textarea>
                     </div>
                     {% if params %}
-                      {% include 'explorer/params.html' %}
+                        {% include 'explorer/params.html' %}
                     {% endif %}
                 </div>
                 <div class="form-group">
                     <div class="text-center">
                         {% if can_change %}
                             <div class="btn-group">
-                              <input type="submit" value="{% trans 'Save & Run' %}" class="btn btn-primary" id="save_button" />
-                              <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                <span class="caret"></span>
-                                <span class="sr-only">{% trans "Toggle Dropdown" %}</span>
-                              </button>
-                              <ul class="dropdown-menu">
-                                {% export_buttons query %}
-                                <li role="separator" class="divider"></li>
-                                <li><input type="submit" value="{% trans 'Save Only' %}" class="btn btn-link" id="save_only"/></li>
-                              </ul>
+                                <input type="submit" value="{% trans 'Save & Run' %}" class="btn btn-primary" id="save_button" />
+                                <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    <span class="caret"></span>
+                                    <span class="sr-only">{% trans "Toggle Dropdown" %}</span>
+                                </button>
+                                <ul class="dropdown-menu">
+                                    {% export_buttons query %}
+                                    <li role="separator" class="divider"></li>
+                                    <li>
+                                        <input type="submit" value="{% trans 'Save Only' %}" class="btn btn-link" id="save_only"/>
+                                    </li>
+                                </ul>
                             </div>
-                            <button type="button" class="btn btn-default" id="format_button">{% trans "Format" %}</button>
-                            <button type="button" class="btn btn-default" id="show_schema_button">{% trans "Show Schema" %}</button>
-                            <button type="button" class="btn btn-default" id="hide_schema_button" style="display: none;">{% trans "Hide Schema" %}</button>
+                            <button type="button" class="btn btn-default" id="format_button">
+                                {% trans "Format" %}
+                            </button>
+                            <button type="button" class="btn btn-default" id="show_schema_button">
+                                {% trans "Show Schema" %}
+                            </button>
+                            <button type="button" class="btn btn-default" id="hide_schema_button" style="display: none;">
+                                {% trans "Hide Schema" %}
+                            </button>
                         {% else %}
-                            <input type="submit" value="{% trans 'Refresh' %}" class="btn btn-default" id="refresh_button" />
+                            <input id="refresh_button" type="submit" value="{% trans 'Refresh' %}" class="btn btn-default" />
                             <div class="btn-group">
-                              <label class="btn btn-default" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{% trans "Download" %}</label>
-                              <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                <span class="caret"></span>
-                                <span class="sr-only">{% trans "Toggle Dropdown" %}</span>
-                              </button>
-                              <ul class="dropdown-menu">
-                                {% export_buttons query %}
-                              </ul>
+                                <label class="btn btn-default" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    {% trans "Download" %}
+                                </label>
+                                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    <span class="caret"></span>
+                                    <span class="sr-only">{% trans "Toggle Dropdown" %}</span>
+                                </button>
+                                <ul class="dropdown-menu">
+                                    {% export_buttons query %}
+                                </ul>
                             </div>
                         {% endif %}
                     </div>
                 </div>
-
             </form>
         </div>
     </div>
@@ -129,20 +167,24 @@ <h2>{% if query %}{{ query.title }}{% if shared %}<small>&nbsp;&nbsp;shared</sma
         <iframe src="" height="828px" frameBorder="0" id="schema_frame"></iframe>
     </div>
 </div>
+
 {% include 'explorer/preview_pane.html' %}
+
 <div class="row">
-  <div class="col-md-6">
-    {% if query and can_change and tasks_enabled %}
-      {{ form.snapshot }} {% blocktrans %}Snapshot{% endblocktrans %}
-    {% endif %}
-  </div>
-  <div class="col-md-6 text-right">
-    <small>
-      {% if query.avg_duration %}
-        {% blocktrans with avg_duration=query.avg_duration user_email=form.created_by_user_email created=form.created_at_time %}Avg. execution: {{ avg_duration|floatformat:2 }}ms. Query created by {{ user_email }} on {{ created }}.{% endblocktrans %}      
-      {% endif %}
-    </small>
-  </div>
+    <div class="col-md-6">
+        {% if query and can_change and tasks_enabled %}
+            {{ form.snapshot }} {% blocktrans %}Snapshot{% endblocktrans %}
+        {% endif %}
+    </div>
+    <div class="col-md-6 text-right">
+        <small>
+            {% if query.avg_duration %}
+                {% blocktrans trimmed with avg_duration=query.avg_duration user_email=form.created_by_user_email created=form.created_at_time %}
+                    Avg. execution: {{ avg_duration|floatformat:2 }}ms. Query created by {{ user_email }} on {{ created }}.
+                {% endblocktrans %}
+            {% endif %}
+        </small>
+    </div>
 </div>
 {% endblock %}
 
diff --git a/explorer/templates/explorer/query_confirm_delete.html b/explorer/templates/explorer/query_confirm_delete.html
index 4cb1d543..6091443c 100644
--- a/explorer/templates/explorer/query_confirm_delete.html
+++ b/explorer/templates/explorer/query_confirm_delete.html
@@ -1,9 +1,12 @@
 {% extends "explorer/base.html" %}
+{% load i18n %}
 
 {% block sql_explorer_content %}
     <form method="post">{% csrf_token %}
         <div class="alert alert-info">
-            {% blocktrans with title=object.title %}Are you sure you want to delete "{{ title }}" ?{% endblocktrans %}
+            {% blocktrans trimmed with title=object.title %}
+                Are you sure you want to delete "{{ title }}"?
+            {% endblocktrans %}
         </div>
         <div>
             <input type="submit" value="Delete Query" class="btn btn-default" />
diff --git a/explorer/templates/explorer/query_list.html b/explorer/templates/explorer/query_list.html
index 27595af7..4d3f162a 100644
--- a/explorer/templates/explorer/query_list.html
+++ b/explorer/templates/explorer/query_list.html
@@ -3,110 +3,127 @@
 
 {% block sql_explorer_navlinks %}
     {% if can_change %}
-    <li><a href="{% url 'query_create' %}">{% trans "New Query" %}</a></li>
-    <li><a href="{% url 'explorer_playground' %}">{% trans "Playground" %}</a></li>
-    <li><a href="{% url 'explorer_logs' %}">{% trans "Logs" %}</a></li>
+        <li><a href="{% url 'query_create' %}">{% trans "New Query" %}</a></li>
+        <li><a href="{% url 'explorer_playground' %}">{% trans "Playground" %}</a></li>
+        <li><a href="{% url 'explorer_logs' %}">{% trans "Logs" %}</a></li>
     {% endif %}
 {% endblock %}
 
 {% block sql_explorer_content %}
     {% if recent_queries|length > 0 %}
-        <h3>{% blocktrans with qlen=recent_queries|length %} Your {{qlen}} Most Recently Run {% endblocktrans %}</h3>
+        <h3>
+            {% blocktrans trimmed with qlen=recent_queries|length %}
+                Your {{qlen}} Most Recently Run
+            {% endblocktrans %}
+        </h3>
         <table class="table table-striped">
             <thead>
                 <tr>
-                    <th>{% trans Query %}</th>
+                    <th>{% trans "Query" %}</th>
                     <th>{% trans "Last Run" %}</th>
                     <th class="text-center">CSV</th>
                 </tr>
             </thead>
             <tbody>
                 {% for object in recent_queries %}
-                <tr>
-                    <td class="name"><a href="{% url 'query_detail' object.query_id %}">{{ object.query.title }}</a></td>
-                    <td>{{ object.run_at|date:"SHORT_DATETIME_FORMAT" }}</td>
-                    <td class="text-center">
-                        <a href="{% url 'download_query' object.query_id %}"><i class="glyphicon glyphicon-download"></i></a>
-                    </td>
-                </tr>
+                    <tr>
+                        <td class="name">
+                            <a href="{% url 'query_detail' object.query_id %}">{{ object.query.title }}</a>
+                        </td>
+                        <td>{{ object.run_at|date:"SHORT_DATETIME_FORMAT" }}</td>
+                        <td class="text-center">
+                            <a href="{% url 'download_query' object.query_id %}">
+                                <i class="glyphicon glyphicon-download"></i>
+                            </a>
+                        </td>
+                    </tr>
                 {% endfor %}
             </tbody>
         </table>
     {% endif %}
 
     <div id="queries">
-      <div class="row">
-        <div class="col-md-6">
-            <h3>{% trans "All Queries" %}</h3>
-        </div>
-        <div class="col-md-6 text-right">
-            <input class="search list-search" placeholder="{% trans 'Search' %}" style="">
+        <div class="row">
+            <div class="col-md-6">
+                <h3>{% trans "All Queries" %}</h3>
+            </div>
+            <div class="col-md-6 text-right">
+                <input class="search list-search" placeholder="{% trans 'Search' %}" style="">
+            </div>
         </div>
-      </div>
-    <table class="table table-striped">
-        <thead>
-            <tr>
-                <th>{% trans "Query" %}</th>
-                <th>{% trans "Created" %}</th>
-                {% if tasks_enabled %}
-                <th>{% trans "Email" %}</th>
-                {% endif %}
-                <th>{% trans "CSV" %}</th>
-                {% if can_change %}
-                <th>{% trans "Play" %}</th>
-                <th>{% trans "Delete" %}</th>
-                {% endif %}
-                <th>{% trans "Run Count" %}</th>
-            </tr>
-        </thead>
-        <tbody class="list">
-            {% for object in object_list %}
-            <tr {% if object.is_in_category %}class="collapse in collapse-{{ object.collapse_target }}"{% endif %}>
-                {% if object.is_header %}
-                    <td colspan="100">
-                        <strong>
-                            <span data-toggle="collapse" data-target=".collapse-{{object.collapse_target}}"
-                                      class="toggle">
-                            {{ object.title }} ({{ object.count }})</span>
-                        </strong>
-                    </td>
-                {% else %}
-                    <td class="name{% if object.is_in_category %} indented{% endif %}">
-                        <a href="{% url 'query_detail' object.id %}">{{ object.title }}</a>
-                    </td>
-                    <td>{{ object.created_at|date:"SHORT_DATE_FORMAT" }}
-                        {% if object.created_by_user %}
-                        {% blocktrans with cuser=object.created_by_user %}by {{cuser}}{% endblocktrans %}
-                        {% endif %}
-                    </td>
+        <table class="table table-striped">
+            <thead>
+                <tr>
+                    <th>{% trans "Query" %}</th>
+                    <th>{% trans "Created" %}</th>
                     {% if tasks_enabled %}
-                      <td>
-                          <a class="email-csv" data-id="{{ object.id }}" href="{% url 'email_csv_query' object.id %}"><i class="glyphicon glyphicon-envelope"></i></a>
-                      </td>
+                        <th>{% trans "Email" %}</th>
                     {% endif %}
-                    <td>
-                        <a href="{% url 'download_query' object.id %}"><i class="glyphicon glyphicon-download"></i></a>
-                    </td>
+                    <th>{% trans "CSV" %}</th>
                     {% if can_change %}
-                        <td>
-                            <a href="{% url 'explorer_playground' %}?query_id={{ object.id }}"><i class="glyphicon glyphicon-new-window"></i></a>
-                        </td>
-                        <td>
-                            <a href="{% url 'query_delete' object.id %}"><i class="glyphicon glyphicon-trash"></i></a>
-                        </td>
+                        <th>{% trans "Play" %}</th>
+                        <th>{% trans "Delete" %}</th>
                     {% endif %}
-                    <td>{{ object.run_count }}</td>
-
-                {% endif %}
-            </tr>
-            {% endfor %}
-        </tbody>
-    </table>
+                    <th>{% trans "Run Count" %}</th>
+                </tr>
+            </thead>
+            <tbody class="list">
+                {% for object in object_list %}
+                    <tr {% if object.is_in_category %}class="collapse in collapse-{{ object.collapse_target }}"{% endif %}>
+                        {% if object.is_header %}
+                            <td colspan="100">
+                                <strong>
+                                    <span data-toggle="collapse" data-target=".collapse-{{object.collapse_target}}" class="toggle">
+                                        {{ object.title }} ({{ object.count }})
+                                    </span>
+                                </strong>
+                            </td>
+                        {% else %}
+                            <td class="name{% if object.is_in_category %} indented{% endif %}">
+                                <a href="{% url 'query_detail' object.id %}">{{ object.title }}</a>
+                            </td>
+                            <td>{{ object.created_at|date:"SHORT_DATE_FORMAT" }}
+                                {% if object.created_by_user %}
+                                    {% blocktrans trimmed with cuser=object.created_by_user %}
+                                        by {{cuser}}
+                                    {% endblocktrans %}
+                                {% endif %}
+                            </td>
+                            {% if tasks_enabled %}
+                              <td>
+                                  <a class="email-csv" data-id="{{ object.id }}" href="{% url 'email_csv_query' object.id %}">
+                                      <i class="glyphicon glyphicon-envelope"></i>
+                                  </a>
+                              </td>
+                            {% endif %}
+                            <td>
+                                <a href="{% url 'download_query' object.id %}">
+                                    <i class="glyphicon glyphicon-download"></i>
+                                </a>
+                            </td>
+                            {% if can_change %}
+                                <td>
+                                    <a href="{% url 'explorer_playground' %}?query_id={{ object.id }}">
+                                        <i class="glyphicon glyphicon-new-window"></i>
+                                    </a>
+                                </td>
+                                <td>
+                                    <a href="{% url 'query_delete' object.id %}">
+                                        <i class="glyphicon glyphicon-trash"></i>
+                                    </a>
+                                </td>
+                            {% endif %}
+                            <td>{{ object.run_count }}</td>
+                        {% endif %}
+                    </tr>
+                {% endfor %}
+            </tbody>
+        </table>
     </div>
 {% endblock %}
 
 {% block sql_explorer_scripts %}
-    <script>
+<script>
     $(function() {
         function SearchFocus() {
             $(".search").focus();
@@ -117,7 +134,6 @@ <h3>{% trans "All Queries" %}</h3>
         };
         var queryList = new List('queries', options);
     });
-
 </script>
 <script src="{% static 'explorer/js/query-list.js' %}"></script>
 {% endblock %}
diff --git a/explorer/templates/explorer/querylog_list.html b/explorer/templates/explorer/querylog_list.html
index b7c4e2cc..47e456b8 100644
--- a/explorer/templates/explorer/querylog_list.html
+++ b/explorer/templates/explorer/querylog_list.html
@@ -3,9 +3,9 @@
 
 {% block sql_explorer_navlinks %}
     {% if can_change %}
-      <li><a href="{% url "query_create" %}">{% trans "New Query" %}</a></li>
-      <li><a href="{% url "explorer_playground" %}">{% trans "Playground" %}</a></li>
-      <li class="active"><a href="">{% trans "Logs" %}</a></li>
+        <li><a href="{% url "query_create" %}">{% trans "New Query" %}</a></li>
+        <li><a href="{% url "explorer_playground" %}">{% trans "Playground" %}</a></li>
+        <li class="active"><a href="">{% trans "Logs" %}</a></li>
     {% endif %}
 {% endblock %}
 
@@ -15,24 +15,40 @@ <h3>{% blocktrans with pagenum=page_obj.number %}Recent Query Logs - Page {{page
         <table class="table table-striped query-list">
             <thead>
                 <tr>
-                    <th>{% blocktrans %}Run At{% endblocktrans %}</th>
-                    <th>{% blocktrans %}Run By{% endblocktrans %}</th>
-                    <th>{% blocktrans %}Duration{% endblocktrans %}</th>
-                    <th class="sql">{% blocktrans %}SQL{% endblocktrans %}</th>
-                    <th>{% blocktrans %}Query ID{% endblocktrans %}</th>
-                    <th>{% blocktrans %}Playground{% endblocktrans %}</th>
+                    <th>{% trans "Run At" %}</th>
+                    <th>{% trans "Run By" %}</th>
+                    <th>{% trans "Duration" %}</th>
+                    <th class="sql">SQL</th>
+                    <th>{% trans "Query ID" %}</th>
+                    <th>{% trans "Playground" %}</th>
                 </tr>
             </thead>
             <tbody>
                 {% for object in recent_logs %}
-                <tr>
-                    <td>{{ object.run_at|date:"SHORT_DATETIME_FORMAT" }}</td>
-                    <td>{{ object.run_by_user.email }}</td>
-                    <td>{{ object.duration|floatformat:2 }}ms</td>
-                    <td class="log-sql">{{ object.sql }}</td>
-                    <td> {% if object.query_id %}<a href="{% url "query_detail" object.query_id %}">{% blocktrans %}Query{% endblocktrans %} {{ object.query_id }}</a>{% elif object.is_playground %}{% blocktrans %}Playground{% endblocktrans %}{% else %}--{% endif %}</td>
-                    <td><a href="{% url "explorer_playground" %}?querylog_id={{ object.id }}">{% blocktrans %}Open{% endblocktrans %}</a></td>
-                </tr>
+                    <tr>
+                        <td>{{ object.run_at|date:"SHORT_DATETIME_FORMAT" }}</td>
+                        <td>{{ object.run_by_user.email }}</td>
+                        <td>{{ object.duration|floatformat:2 }}ms</td>
+                        <td class="log-sql">{{ object.sql }}</td>
+                        <td>
+                            {% if object.query_id %}
+                                <a href="{% url "query_detail" object.query_id %}">
+                                    {% blocktrans trimmed with query_id=object.query_id %}
+                                        Query {{ query_id }}
+                                    {% endblocktrans %}
+                                </a>
+                            {% elif object.is_playground %}
+                                {% trans "Playground" %}
+                            {% else %}
+                                --
+                            {% endif %}
+                        </td>
+                        <td>
+                            <a href="{% url "explorer_playground" %}?querylog_id={{ object.id }}">
+                                {% trans "Open" %}
+                            </a>
+                        </td>
+                    </tr>
                 {% endfor %}
             </tbody>
         </table>
@@ -44,7 +60,9 @@ <h3>{% blocktrans with pagenum=page_obj.number %}Recent Query Logs - Page {{page
                     <a href="?page={{ page_obj.previous_page_number }}"><<</a>
                 {% endif %}
                 <span class="page-current">
-                    {% blocktrans with pnum=page_obj.number anum=page_obj.paginator.num_pages %}Page {{ pnum }} of {{ anum }}.{% endblocktrans %}
+                    {% blocktrans trimmed with pnum=page_obj.number anum=page_obj.paginator.num_pages %}
+                        Page {{ pnum }} of {{ anum }}.
+                    {% endblocktrans %}
                 </span>
                 {% if page_obj.has_next %}
                     <a href="?page={{ page_obj.next_page_number }}">>></a>
diff --git a/explorer/templates/explorer/schema.html b/explorer/templates/explorer/schema.html
index 4816c4e6..9e8bee5f 100644
--- a/explorer/templates/explorer/schema.html
+++ b/explorer/templates/explorer/schema.html
@@ -4,17 +4,21 @@
 
 {% block sql_explorer_content_takeover %}
 <div class="schema-wrapper">
-    <h4 class="text-center">{% blocktrans %}Schema{% endblocktrans %}</h4>
+    <h4 class="text-center">{% trans "Schema" %}</h4>
     <div id="tables">
         <p class="text-center">
-          <input class="search" placeholder="{% blocktrans %}Search{% endblocktrans %}" />
+          <input class="search" placeholder="{% trans "Search" %}" />
         </p>
         <div class="row">
             <div class="col-xs-6 text-center">
-                <a class="btn btn-link" id="collapse_all">{% trans "Collapse All" %}</a>
+                <a class="btn btn-link" id="collapse_all">
+                    {% trans "Collapse All" %}
+                </a>
             </div>
             <div class="col-xs-6 text-center">
-                <a class="btn btn-link" id="expand_all">{% trans "Expand All" %}</a>
+                <a class="btn btn-link" id="expand_all">
+                    {% trans "Expand All" %}
+                </a>
             </div>
         </div>
         <ul class="list">
@@ -30,11 +34,11 @@ <h4 class="name panel-title" style="display: inline-block">{{ m.0 }}</h4>
                                 </thead>
                                 <tbody>
                                     {% for c in m.1 %}
-                                    <tr>
-                                        <td width="50%"><code>{{ c.0 }}</code></td>
-                                        <!-- This will show the type of the column as well -->
-                                        <td width="50%" class="text-muted"><small>{{ c.1 }}</small></td>
-                                    </tr>
+                                        <tr>
+                                            <td width="50%"><code>{{ c.0 }}</code></td>
+                                            <!-- This will show the type of the column as well -->
+                                            <td width="50%" class="text-muted"><small>{{ c.1 }}</small></td>
+                                        </tr>
                                     {% endfor %}
                                 </tbody>
                             </table>
diff --git a/explorer/templates/explorer/schema_building.html b/explorer/templates/explorer/schema_building.html
index 521ae442..57b80631 100644
--- a/explorer/templates/explorer/schema_building.html
+++ b/explorer/templates/explorer/schema_building.html
@@ -2,10 +2,8 @@
 {% load i18n %}
 
 {% block sql_explorer_content_takeover %}
-
-  <div class="schema-wrapper">
-    <h4 class="text-center">{% blocktrans %}Schema is building...{% endblocktrans %}</h4>
-    <div>{% blocktrans %}Please wait a minute, and refresh.{% endblocktrans %}</div>
-  </div>
-
-{% endblock %}
\ No newline at end of file
+    <div class="schema-wrapper">
+        <h4 class="text-center">{% trans "Schema is building..." %}</h4>
+        <div>{% trans "Please wait a minute, and refresh." %}</div>
+    </div>
+{% endblock %}
diff --git a/manage.py b/manage.py
index 5ef8448a..02d1103e 100644
--- a/manage.py
+++ b/manage.py
@@ -1,8 +1,11 @@
 #!/usr/bin/env python
-import os, sys
+import os
+import sys
+
+from django.core import management
+
 sys.path.append(os.path.join(os.path.dirname(__file__), 'explorer'))
 os.environ['DJANGO_SETTINGS_MODULE'] = 'test_project.settings'
-from django.core import management
+
 if __name__ == "__main__":
     management.execute_from_command_line()
- 
\ No newline at end of file


Test patch:
diff --git a/test_project/settings.py b/test_project/settings.py
index cf7e4d80..3f322836 100644
--- a/test_project/settings.py
+++ b/test_project/settings.py
@@ -1,6 +1,6 @@
-import django
 import os
 import djcelery
+
 SECRET_KEY = 'shhh'
 DEBUG = True
 STATIC_URL = '/static/'