Skip to content

Commit

Permalink
Add col-X classes to HTML table on custom query page
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Apr 19, 2018
1 parent 1e4c295 commit e2750c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def render(self, templates, **context):
**context, **{
'app_css_hash': self.ds.app_css_hash(),
'select_templates': select_templates,
'zip': zip,
}
})
)
Expand Down
6 changes: 3 additions & 3 deletions datasette/templates/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ <h3>Query parameters</h3>
<table>
<thead>
<tr>
{% for column in columns %}<th scope="col">{{ column }}</th>{% endfor %}
{% for column in columns %}<th class="col-{{ column|to_css_class }}" scope="col">{{ column }}</th>{% endfor %}
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
{% for td in row %}
<td>{% if td == None %}{{ "&nbsp;"|safe }}{% else %}{{ td }}{% endif %}</td>
{% for column, td in zip(columns, row) %}
<td class="col-{{ column|to_css_class }}">{% if td == None %}{{ "&nbsp;"|safe }}{% else %}{{ td }}{% endif %}</td>
{% endfor %}
</tr>
{% endfor %}
Expand Down

0 comments on commit e2750c7

Please sign in to comment.