diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-04-28 09:55:25 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-11-16 17:04:41 +0100 |
commit | 6ef9750adef894a11001b959ba0f31def1f3fdd4 (patch) | |
tree | f961357376645bd08cb3c390f31be4dc7552860c /ishtar_common/widgets.py | |
parent | 2b76e74d49cb0aab595ecd61ee0a7632e97753e0 (diff) | |
download | Ishtar-6ef9750adef894a11001b959ba0f31def1f3fdd4.tar.bz2 Ishtar-6ef9750adef894a11001b959ba0f31def1f3fdd4.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 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 |