Check later for origin as on edit

This commit is contained in:
Sebastian Lohff 2017-04-15 17:05:03 +02:00
parent 4a7fa8520c
commit 306e66440d
1 changed files with 3 additions and 2 deletions

View File

@ -174,8 +174,6 @@ class InetNumForm(MntFormMixin, WhoisObjectFormMixin, forms.ModelForm):
def clean_parent_range(self): def clean_parent_range(self):
parent_range = self.cleaned_data.get('parent_range', None) parent_range = self.cleaned_data.get('parent_range', None)
if parent_range.origin_as.count() > 0:
raise forms.ValidationError("Parent range has origin as set")
# allow parent range to be unset for already present objects # allow parent range to be unset for already present objects
if not parent_range and (self._create or not self._create and self.instance.parent_range): if not parent_range and (self._create or not self._create and self.instance.parent_range):
@ -189,6 +187,9 @@ class InetNumForm(MntFormMixin, WhoisObjectFormMixin, forms.ModelForm):
raise forms.ValidationError("No circular dependencies allowed") raise forms.ValidationError("No circular dependencies allowed")
obj = obj.parent_range obj = obj.parent_range
if parent_range.origin_as.count() > 0:
raise forms.ValidationError("Parent range has origin as set")
return parent_range return parent_range
def clean(self): def clean(self):