@@ -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 |
General Comments 0
You need to be logged in to leave comments.
Login now