diff --git a/backend/apps/fertilizer/templates/fertilizer/delivery_pdf.html b/backend/apps/fertilizer/templates/fertilizer/delivery_pdf.html
index dd8acb5..64ebee1 100644
--- a/backend/apps/fertilizer/templates/fertilizer/delivery_pdf.html
+++ b/backend/apps/fertilizer/templates/fertilizer/delivery_pdf.html
@@ -1,3 +1,4 @@
+{% load fertilizer_tags %}
@@ -47,7 +48,7 @@
| ★{{ group.name }} |
{% for total in group.totals %}
- {% if total %}{{ total }}{% else %}-{% endif %} |
+ {% if total %}{{ total|bags_fmt }}{% else %}-{% endif %} |
{% endfor %}
{# 圃場サブ行 #}
@@ -55,7 +56,7 @@
| {{ row.field.name }}({{ row.field.area_tan }}反) |
{% for cell in row.cells %}
- {% if cell %}{{ cell }}{% else %}-{% endif %} |
+ {% if cell %}{{ cell|bags_fmt }}{% else %}-{% endif %} |
{% endfor %}
{% endfor %}
@@ -65,7 +66,7 @@
| 合計 |
{% for total in page.fert_totals %}
- {{ total }} |
+ {{ total|bags_fmt }} |
{% endfor %}
diff --git a/backend/apps/fertilizer/templatetags/__init__.py b/backend/apps/fertilizer/templatetags/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/backend/apps/fertilizer/templatetags/fertilizer_tags.py b/backend/apps/fertilizer/templatetags/fertilizer_tags.py
new file mode 100644
index 0000000..b0c7997
--- /dev/null
+++ b/backend/apps/fertilizer/templatetags/fertilizer_tags.py
@@ -0,0 +1,15 @@
+from decimal import Decimal
+from django import template
+
+register = template.Library()
+
+
+@register.filter
+def bags_fmt(value):
+ """袋数を整数 or 小数点以下1桁で表示する。"""
+ if value is None or value == '':
+ return value
+ d = Decimal(str(value))
+ if d == d.to_integral_value():
+ return str(int(d))
+ return str(d.quantize(Decimal('0.1')))