Skip to content

Commit

Permalink
Fix Detail page to not use label to get value (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee authored Aug 4, 2023
1 parent d843b93 commit f5c1856
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions sqladmin/templates/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ <h3 class="card-title">
</thead>
<tbody>
{% for name in model_view._details_prop_names %}
{% set name = model_view._column_labels.get(name, name) %}
{% set label = model_view._column_labels.get(name, name) %}
<tr>
<td>{{ name }}</td>
<td>{{ label }}</td>
{% set value, formatted_value = model_view.get_detail_value(model, name) %}
{% if name in model_view._relation_names %}
{% if is_list( value ) %}
Expand Down
10 changes: 5 additions & 5 deletions sqladmin/templates/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ <h3 class="card-title">{{ model_view.name_plural }}</h3>
<th class="w-1"><input class="form-check-input m-0 align-middle" type="checkbox" aria-label="Select all" id="select-all"></th>
<th class="w-1"></th>
{% for name in model_view._list_prop_names %}
{% set name = model_view._column_labels.get(name, name) %}
{% set label = model_view._column_labels.get(name, name) %}
<th>
{% if name in model_view._sort_fields %}
{% if request.query_params.get("sortBy") == name and request.query_params.get("sort") == "asc" %}
<a href="{{ request.url.include_query_params(sort='desc') }}"><i class="fa-solid fa-arrow-down"></i> {{ name }}</a>
<a href="{{ request.url.include_query_params(sort='desc') }}"><i class="fa-solid fa-arrow-down"></i> {{ label }}</a>
{% elif request.query_params.get("sortBy") == name and request.query_params.get("sort") == "desc" %}
<a href="{{ request.url.include_query_params(sort='asc') }}"><i class="fa-solid fa-arrow-up"></i> {{ name }}</a>
<a href="{{ request.url.include_query_params(sort='asc') }}"><i class="fa-solid fa-arrow-up"></i> {{ label }}</a>
{% else %}
<a href="{{ request.url.include_query_params(sortBy=name, sort='asc') }}">{{ name }}</a>
<a href="{{ request.url.include_query_params(sortBy=name, sort='asc') }}">{{ label }}</a>
{% endif %}
{% else %}
{{ name }}
{{ label }}
{% endif %}
</th>
{% endfor %}
Expand Down

0 comments on commit f5c1856

Please sign in to comment.