summaryrefslogtreecommitdiff
path: root/ishtar_common/widgets.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r--ishtar_common/widgets.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py
index 8f95f4521..008925276 100644
--- a/ishtar_common/widgets.py
+++ b/ishtar_common/widgets.py
@@ -521,18 +521,23 @@ class CustomWidget(forms.TextInput):
class SquareMeterWidget(CustomWidget):
- TEMPLATE = "widgets/SquareMeterWidget.html"
- EXTRA_DCT = {"unit": settings.SURFACE_UNIT_LABEL}
+ TEMPLATE = "widgets/UnitWidget.html"
+ EXTRA_DCT = {"unit1": "m²", "unit2": "ha", "factor": 10000}
class GramKilogramWidget(CustomWidget):
- TEMPLATE = "widgets/GramKilogramWidget.html"
- EXTRA_DCT = {"unit": "g"}
+ TEMPLATE = "widgets/UnitWidget.html"
+ EXTRA_DCT = {"unit1": "g", "unit2": "kg", "factor": 1000}
class CentimeterMeterWidget(CustomWidget):
- TEMPLATE = "widgets/CentimeterMeterWidget.html"
- EXTRA_DCT = {"unit": "cm"}
+ TEMPLATE = "widgets/UnitWidget.html"
+ EXTRA_DCT = {"unit1": "cm", "unit2": "m", "factor": 100}
+
+
+class MeterKilometerWidget(CustomWidget):
+ TEMPLATE = "widgets/UnitWidget.html"
+ EXTRA_DCT = {"unit1": "m", "unit2": "km", "factor": 1000}
AreaWidget = forms.TextInput