-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwidgets.py
35 lines (27 loc) · 1.15 KB
/
widgets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from django.forms.widgets import CheckboxInput, NumberInput
class LayerSelectWidget(CheckboxInput):
template_name = 'widgets/layer_switch.html'
# def __init__(self, attrs=None):
# super(CheckboxInput, self).__init__(attrs)
class SliderWidget(NumberInput):
# Caution: As worksround, the slider was renamed as there's a template in
# stemp app with the same name.
# For details see https://github.com/rl-institut/WAM/issues/12
template_name = 'widgets/slider_abw.html'
# def __init__(self, step_size=1, attrs=None):
# super(SliderWidget, self).__init__(attrs)
# self.step_size = step_size
#
# def __get_precision(self):
# try:
# return len(str(self.step_size).split('.')[1])
# except IndexError:
# return 0
#
# def get_context(self, name, value, attrs):
# context = super(SliderWidget, self).get_context(name, value, attrs)
# context['widget']['step_size'] = self.step_size
# #context['widget']['precision'] = self.__get_precision()
# return context
class EsysSwitchWidget(NumberInput):
template_name = 'widgets/esys_switch.html'