diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-04-28 09:55:25 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:47 +0200 |
commit | 96ad40f28ff3e17f8173ec8de8b63ef6056e6e55 (patch) | |
tree | 5284082668976459d1b304532f883aad0f8044a9 /ishtar_common/widgets.py | |
parent | c706c72acceef2665bd0a44214401fcb9cd38033 (diff) | |
download | Ishtar-96ad40f28ff3e17f8173ec8de8b63ef6056e6e55.tar.bz2 Ishtar-96ad40f28ff3e17f8173ec8de8b63ef6056e6e55.zip |
WIP: preventive forms
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r-- | ishtar_common/widgets.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 0b5804748..b80faee6d 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 |