@@ -13,11 +13,16 class JARSConfigurationForm(forms.ModelForm): | |||
|
13 | 13 | if instance.experiment: |
|
14 | 14 | self.fields['experiment'].widget.attrs['disabled'] = 'disabled' |
|
15 | 15 | |
|
16 | #self.fields['experiment'].widget.attrs['readonly'] = True | |
|
17 | #self.fields['experiment'].widget.choices = [(instance.experiment.id, instance.experiment)] | |
|
18 | ||
|
19 | 16 | self.fields['device'].widget.choices = [(device.id, device) for device in devices] |
|
20 | 17 | |
|
18 | #-------------JARS Configuration needs an Experiment----------------- | |
|
19 | def clean(self): | |
|
20 | cleaned_data = super(JARSConfigurationForm, self).clean() | |
|
21 | experiment = cleaned_data.get("experiment") | |
|
22 | if experiment == None: | |
|
23 | msg = "Jars Configuration needs an Experiment." | |
|
24 | self.add_error('experiment', msg) | |
|
25 | ||
|
21 | 26 | class Meta: |
|
22 | 27 | model = JARSConfiguration |
|
23 | 28 | exclude = ('type', 'parameters', 'status') |
General Comments 0
You need to be logged in to leave comments.
Login now