Domain display fixes

This commit is contained in:
Sebastian Lohff 2017-04-04 02:53:25 +02:00
parent 2bda17a6e1
commit 93da6a1c41
2 changed files with 10 additions and 4 deletions

View File

@ -75,6 +75,10 @@ class NameserverForm(MntFormMixin, WhoisObjectFormMixin, forms.ModelForm):
if not name.endswith("."): if not name.endswith("."):
name += "." name += "."
# allow name to stay if it did not change
if not self._create and self.instance.name == name:
return name
if name.count(".") <= 2: if name.count(".") <= 2:
raise forms.ValidationError("Nameserver must be inside a domain (e.g. ns1.noot.dn.)") raise forms.ValidationError("Nameserver must be inside a domain (e.g. ns1.noot.dn.)")
@ -138,6 +142,10 @@ class ReverseZoneForm(forms.ModelForm):
model = ReverseZone model = ReverseZone
fields = ['parentNet', 'nameservers'] fields = ['parentNet', 'nameservers']
help_texts = {
"prefix": "The prefix in CIDR form for which this object is responsible",
}
def __init__(self, user, *args, **kwargs): def __init__(self, user, *args, **kwargs):
self._user = user self._user = user
@ -157,8 +165,6 @@ class ReverseZoneForm(forms.ModelForm):
self.fields['nameservers'].queryset.distinct() self.fields['nameservers'].queryset.distinct()
def clean(self): def clean(self):
cleaned_data = super(ReverseZoneForm, self).clean() cleaned_data = super(ReverseZoneForm, self).clean()

View File

@ -72,10 +72,10 @@
{% for reversezone in reversezones %} {% for reversezone in reversezones %}
<tr> <tr>
<td><a href="{% url "domains:reversezone-show" reversezone.pk %}">{{ reversezone.prefix }}</a></td> <td><a href="{% url "domains:reversezone-show" reversezone.pk %}">{{ reversezone.prefix }}</a></td>
<td></td> <td>{{ reversezone.parentNet|linkObject }}</td>
<td> <td>
<ul> <ul>
{% for nameserver in domain.nameservers.all %} {% for nameserver in reversezone.nameservers.all %}
<li>{{ nameserver|linkObject }}</li> <li>{{ nameserver|linkObject }}</li>
{% endfor %} {% endfor %}
</ul> </ul>