@@ -17,14 +17,12 class DDSConfigurationForm(forms.ModelForm): | |||
|
17 | 17 | devices = Device.objects.filter(device_type__name='dds') |
|
18 | 18 | |
|
19 | 19 | self.fields['experiment'].widget.attrs['readonly'] = True |
|
20 | self.fields['experiment'].widget.choices = [(instance.experiment.id, instance.experiment)] | |
|
20 | ||
|
21 | if instance.experiment is not None: | |
|
22 | self.fields['experiment'].widget.choices = [(instance.experiment.id, instance.experiment)] | |
|
21 | 23 | |
|
22 | 24 | self.fields['device'].widget.choices = [(device.id, device) for device in devices] |
|
23 | 25 | |
|
24 | # | |
|
25 | # def clean(self): | |
|
26 | # # Custom validation to force an integer when type of unit = "Unit" | |
|
27 | # return | |
|
28 | 26 | |
|
29 | 27 | class Meta: |
|
30 | 28 | model = DDSConfiguration |
General Comments 0
You need to be logged in to leave comments.
Login now