Only show distinct nameservers in domain form

This commit is contained in:
Sebastian Lohff 2017-04-05 02:32:11 +02:00
parent 93da6a1c41
commit c1afcbfa3a
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ class DomainForm(MntFormMixin, WhoisObjectFormMixin, forms.ModelForm):
self.fields['name'].disabled = True self.fields['name'].disabled = True
self.fields['nameservers'].queryset |= self.instance.nameservers.all() self.fields['nameservers'].queryset |= self.instance.nameservers.all()
self.fields['nameservers'].queryset.distinct() self.fields['nameservers'].queryset = self.fields['nameservers'].queryset.distinct()
def clean_name(self): def clean_name(self):
name = self.cleaned_data['name'].lower() name = self.cleaned_data['name'].lower()
@ -163,7 +163,7 @@ class ReverseZoneForm(forms.ModelForm):
self.fields['prefix'].disabled = True self.fields['prefix'].disabled = True
self.fields['nameservers'].queryset |= self.instance.nameservers.all() self.fields['nameservers'].queryset |= self.instance.nameservers.all()
self.fields['nameservers'].queryset.distinct() self.fields['nameservers'].queryset = self.fields['nameservers'].queryset.distinct()
def clean(self): def clean(self):
cleaned_data = super(ReverseZoneForm, self).clean() cleaned_data = super(ReverseZoneForm, self).clean()