Ejemplo n.º 1
0
 def addField(cls, option):
     types = json.loads(option.types)
     for t in types:
         types += DataType.getChilds(id=t)
     sensors = Sensor.getTypesFilter(types=types)
     if (option.group):
         cls.addGroupModelChoiceField(key=option.key, label=option.name, min=option.groupmin, max=option.groupmax, queryset=sensors, group_by_field='device_id', empty_label="--Select Sensor--", help_text=option.description)
     else:
         cls.addModelChoiceField(key=option.key, label=option.name, required=option.required, queryset=sensors, group_by_field='device_id', empty_label="--Select Sensor--", help_text=option.description)
Ejemplo n.º 2
0
 def addField(cls, option):
     types = json.loads(option.types)
     for t in types:
         types += DataType.getChilds(id=t)
     sensors = Sensor.getTypesFilter(types=types)
     if (option.group):
         cls.addGroupModelChoiceField(key=option.key, label=option.name, min=option.groupmin, max=option.groupmax, queryset=sensors, group_by_field='device_id', empty_label="--Select Sensor--", help_text=option.description)
     else:
         cls.addModelChoiceField(key=option.key, label=option.name, required=option.required, queryset=sensors, group_by_field='device_id', empty_label="--Select Sensor--", help_text=option.description)
Ejemplo n.º 3
0
 def addField(cls, option):
     types = json.loads(option.types)
     datatypes = []
     for t in types:
         args = ()
         for d in t:
             l = [d]
             l += DataType.getChilds(id=d)
             args += (l,)
             for p in itertools.product(*args):
                 datatypes.append(''.join(p))
     commands = Command.getTypesFilter(types=datatypes)
     cls.addGroupedModelChoiceField(key=option.key, label=option.name, required=option.required, queryset=commands, group_by_field='device_id', empty_label="--Select Command--", help_text=option.description)
Ejemplo n.º 4
0
 def addField(cls, option):
     types = json.loads(option.types)
     datatypes = []
     for t in types:
         args = ()
         for d in t:
             l = [d]
             l += DataType.getChilds(id=d)
             args += (l,)
             for p in itertools.product(*args):
                 datatypes.append(''.join(p))
     commands = Command.getTypesFilter(types=datatypes)
     cls.addModelChoiceField(key=option.key, label=option.name, required=option.required, queryset=commands, group_by_field='device_id', empty_label="--Select Command--", help_text=option.description)