|
@@ -2291,11 +2291,12 @@ class BaseVCMemberFormSet(forms.BaseModelFormSet):
|
|
|
# Check for duplicate VC position values
|
|
|
vc_position_list = []
|
|
|
for form in self.forms:
|
|
|
- vc_position = form.cleaned_data['vc_position']
|
|
|
- if vc_position in vc_position_list:
|
|
|
- error_msg = 'A virtual chassis member already exists in position {}.'.format(vc_position)
|
|
|
- form.add_error('vc_position', error_msg)
|
|
|
- vc_position_list.append(vc_position)
|
|
|
+ vc_position = form.cleaned_data.get('vc_position')
|
|
|
+ if vc_position:
|
|
|
+ if vc_position in vc_position_list:
|
|
|
+ error_msg = 'A virtual chassis member already exists in position {}.'.format(vc_position)
|
|
|
+ form.add_error('vc_position', error_msg)
|
|
|
+ vc_position_list.append(vc_position)
|
|
|
|
|
|
|
|
|
class DeviceVCMembershipForm(forms.ModelForm):
|