dont show the 'add reverse record' checkbox if on form for adding reverse record
This commit is contained in:
parent
308be6a025
commit
3a9e9fe614
|
@ -24,7 +24,10 @@ class CustomUnicodeListField(forms.CharField):
|
||||||
### Form Models
|
### Form Models
|
||||||
|
|
||||||
class FormAddRecord(forms.Form):
|
class FormAddRecord(forms.Form):
|
||||||
""" Form used to add a DNS record. """
|
""" Form used to add a DNS record.
|
||||||
|
TODO: Right now this form only supports forward zone creation.
|
||||||
|
It wont accept values if you try to manually add a PTR.
|
||||||
|
"""
|
||||||
dns_server = forms.CharField(max_length=100)
|
dns_server = forms.CharField(max_length=100)
|
||||||
record_name = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$", required=False)
|
record_name = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$", required=False)
|
||||||
record_type = forms.ChoiceField(choices=local_settings.RECORD_TYPE_CHOICES)
|
record_type = forms.ChoiceField(choices=local_settings.RECORD_TYPE_CHOICES)
|
||||||
|
@ -34,7 +37,6 @@ class FormAddRecord(forms.Form):
|
||||||
create_reverse = forms.BooleanField(required=False)
|
create_reverse = forms.BooleanField(required=False)
|
||||||
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False)
|
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False)
|
||||||
|
|
||||||
|
|
||||||
class FormAddCnameRecord(forms.Form):
|
class FormAddCnameRecord(forms.Form):
|
||||||
""" Form used to add a CNAME record. """
|
""" Form used to add a CNAME record. """
|
||||||
dns_server = forms.CharField(max_length=100)
|
dns_server = forms.CharField(max_length=100)
|
||||||
|
|
|
@ -6,7 +6,7 @@ Add record in {{ zone_name }}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<form class="form-horizontal" action="/add_record/result/" method="post">{% csrf_token %}
|
<form class="form-horizontal" action="/add_record/result/" method="post">{% csrf_token %}
|
||||||
<legend>Create Foward Record</legend>
|
<legend>Create Record</legend>
|
||||||
<input type="hidden" name="zone_name" value="{{zone_name}}"/>
|
<input type="hidden" name="zone_name" value="{{zone_name}}"/>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
@ -36,11 +36,13 @@ Add record in {{ zone_name }}
|
||||||
<label class="control-label">Record Type: </label>
|
<label class="control-label">Record Type: </label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<select name="record_type">
|
<select name="record_type">
|
||||||
{% for type, name in record_type_choices %}
|
{% if "in-addr.arpa" not in zone_name and "ip.arpa" not in zone_name %}
|
||||||
<option value="{{name}}">
|
{% for type, name in record_type_choices %}
|
||||||
{{name}}
|
<option value="{{name}}">{{name}}</option>
|
||||||
</option>
|
{% endfor %}
|
||||||
{% endfor %}
|
{% else %}
|
||||||
|
<option value="PTR">PTR</option>
|
||||||
|
{% endif %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -72,13 +74,15 @@ Add record in {{ zone_name }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if "in-addr.arpa" not in zone_name and "ip.arpa" not in zone_name %}
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" name="create_reverse" value="True">Create Reverse Record
|
<input type="checkbox" name="create_reverse" value="True">Create Reverse Record (PTR)
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">TSIG Key: </label>
|
<label class="control-label">TSIG Key: </label>
|
||||||
|
|
Loading…
Reference in New Issue