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