Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve total output. #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ Use the following command: <b><i>pip install django-totalsum-admin</i></b>

```py
INSTALLED_APPS = {
...,
# ...,
'django.contrib.humanize',
# ...,
'totalsum',
...
# ...,
}
```

Expand Down
12 changes: 7 additions & 5 deletions totalsum/templates/totalsum_change_list_results.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n static %}
{% load humanize i18n static %}
{% load totalsum %}
{% if result_hidden_fields %}
<div class="hiddenfields">{# DIV for HTML validation #}
Expand Down Expand Up @@ -50,10 +50,12 @@
<tr class="totals">
{% for header in result_headers %}
{% with header.text as header_text %}
<td>
{% if totals|get_total:header_text != '' %}
{{ totals|get_total:header_text }} {{ unit_of_measure|safe }}
{% endif %}
<td style="white-space: nowrap;">
{% with totals|get_total:header_text as total %}
{% if total %}
{{ total|intcomma }} {{ unit_of_measure|safe }}
{% endif %}
{% endwith %}
</td>
{% endwith %}
{% endfor %}
Expand Down