dont show the 'add reverse record' checkbox if on form for adding reverse record

This commit is contained in:
Jeffrey Forman 2012-12-12 21:12:58 -05:00
parent 308be6a025
commit 3a9e9fe614
2 changed files with 15 additions and 9 deletions

View File

@ -24,7 +24,10 @@ class CustomUnicodeListField(forms.CharField):
### Form Models
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)
record_name = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$", required=False)
record_type = forms.ChoiceField(choices=local_settings.RECORD_TYPE_CHOICES)
@ -34,7 +37,6 @@ class FormAddRecord(forms.Form):
create_reverse = forms.BooleanField(required=False)
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False)
class FormAddCnameRecord(forms.Form):
""" Form used to add a CNAME record. """
dns_server = forms.CharField(max_length=100)

View File

@ -6,7 +6,7 @@ Add record in {{ zone_name }}
{% block body %}
<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}}"/>
<div class="control-group">
@ -36,11 +36,13 @@ Add record in {{ zone_name }}
<label class="control-label">Record Type: </label>
<div class="controls">
<select name="record_type">
{% for type, name in record_type_choices %}
<option value="{{name}}">
{{name}}
</option>
{% endfor %}
{% if "in-addr.arpa" not in zone_name and "ip.arpa" not in zone_name %}
{% for type, name in record_type_choices %}
<option value="{{name}}">{{name}}</option>
{% endfor %}
{% else %}
<option value="PTR">PTR</option>
{% endif %}
</select>
</div>
</div>
@ -72,13 +74,15 @@ Add record in {{ zone_name }}
</div>
</div>
{% if "in-addr.arpa" not in zone_name and "ip.arpa" not in zone_name %}
<div class="control-group">
<div class="controls">
<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>
</div>
</div>
{% endif %}
<div class="control-group">
<label class="control-label">TSIG Key: </label>