@@ -21,9 +21,9 class JARSConfigurationForm(forms.ModelForm): | |||||
21 | if instance and instance.pk: |
|
21 | if instance and instance.pk: | |
22 | devices = Device.objects.filter(device_type__name='jars') |
|
22 | devices = Device.objects.filter(device_type__name='jars') | |
23 |
|
23 | |||
24 | if instance.experiment: |
|
24 | #if instance.experiment: | |
25 | experiments = Experiment.objects.filter(pk=instance.experiment.id) |
|
25 | # experiments = Experiment.objects.filter(pk=instance.experiment.id) | |
26 | self.fields['experiment'].widget.choices = [(experiment.id, experiment) for experiment in experiments] |
|
26 | # self.fields['experiment'].widget.choices = [(experiment.id, experiment) for experiment in experiments] | |
27 |
|
27 | |||
28 | self.fields['device'].widget.choices = [(device.id, device) for device in devices] |
|
28 | self.fields['device'].widget.choices = [(device.id, device) for device in devices] | |
29 | #self.fields['spectral'].widget = SpectralWidget() |
|
29 | #self.fields['spectral'].widget = SpectralWidget() | |
@@ -31,12 +31,12 class JARSConfigurationForm(forms.ModelForm): | |||||
31 | self.fields['spectral'].widget = SpectralWidget() |
|
31 | self.fields['spectral'].widget = SpectralWidget() | |
32 |
|
32 | |||
33 | #-------------JARS Configuration needs an Experiment----------------- |
|
33 | #-------------JARS Configuration needs an Experiment----------------- | |
34 | def clean(self): |
|
34 | #def clean(self): | |
35 | cleaned_data = super(JARSConfigurationForm, self).clean() |
|
35 | # cleaned_data = super(JARSConfigurationForm, self).clean() | |
36 | experiment = cleaned_data.get('experiment') |
|
36 | # experiment = cleaned_data.get('experiment') | |
37 | if not experiment: |
|
37 | # if not experiment: | |
38 | msg = "Error: Jars Configuration needs an Experiment" |
|
38 | # msg = "Error: Jars Configuration needs an Experiment" | |
39 | self.add_error('experiment', msg) |
|
39 | # self.add_error('experiment', msg) | |
40 |
|
40 | |||
41 | class Meta: |
|
41 | class Meta: | |
42 | model = JARSConfiguration |
|
42 | model = JARSConfiguration |
@@ -273,7 +273,7 class JARSConfiguration(Configuration): | |||||
273 | return False |
|
273 | return False | |
274 |
|
274 | |||
275 | json_data = json.dumps(data) |
|
275 | json_data = json.dumps(data) | |
276 | print json_data |
|
276 | ||
277 | try: |
|
277 | try: | |
278 | payload = self.request('write', 'post', json=json_data) |
|
278 | payload = self.request('write', 'post', json=json_data) | |
279 | self.device.status = payload['status'] |
|
279 | self.device.status = payload['status'] |
General Comments 0
You need to be logged in to leave comments.
Login now