template cleanup on adding records. use of tsig key is now optional

This commit is contained in:
Jeffrey Forman 2012-10-13 17:00:22 -04:00
parent 1e2260bbec
commit d2a6b38a2b
7 changed files with 32 additions and 19 deletions

View File

@ -16,4 +16,4 @@ class FormAddRecord(forms.Form):
ttl = forms.ChoiceField(choices=TTL_CHOICES, label="TTL", initial=86400)
create_reverse = forms.BooleanField(label="Create Reverse Record (PTR)?", required=False)
data = forms.CharField(max_length=256, label="Record Data (IP/Hostname)")
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), empty_label=None, label="TSIG Key")
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), empty_label=None, label="TSIG Key", required=False)

View File

@ -74,10 +74,10 @@ def add_record(form_data):
"""Add a DNS record with data from a FormAddRecord object.
If a reverse PTR record is requested, this will be added too."""
try:
if form_data["key_name"]:
keyring = create_keyring(form_data["key_name"])
except Exception, err:
raise Exception("Error creating keyring in add_record: %s" % err)
else:
keyring = None
response = {}
forward_response = add_forward_record(form_data, keyring)

View File

@ -25,8 +25,16 @@
<body>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="/files/static/bootstrap/js/bootstrap.min.js"></script>
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">
{% block pageheader %}
{% endblock pageheader %}
</a>
</div>
</div>
{% block errors %}

View File

@ -1,8 +1,12 @@
{% extends "base.htm" %}
{% block pageheader %}
Add record in {{ dns_server }}
{% endblock pageheader %}
{% block body %}
<form action="/add_record/result/" method="post">{% csrf_token %}
<table>
<table class="table">
{{ form.as_table }}
</table>
<input type="submit" value="Submit" />

View File

@ -1,19 +1,20 @@
{% extends "base.htm" %}
{% block pageheader %}
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">Server Zone List for {{ dns_server }}</a>
</div>
</div>
Server Zone List for {{ dns_server }}
{% endblock pageheader %}
{% block body %}
<table class="table">
<tr>
<th>Zone</th>
<th>Serial Number</th>
</tr>
{% for current_zone in zone_array %}
<tr>
<td><a href="/info/{{ dns_server }}/{{ current_zone }}/"> {{ current_zone }}</td>
<td><a href="/info/{{ dns_server }}/{{ current_zone.zone_name }}/"> {{ current_zone.zone_name }}</td>
<td>{{ current_zone.zone_serial }}</td>
</tr>
{% endfor %}
</table>

View File

@ -2,11 +2,7 @@
{% block pageheader %}
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">Server List</a>
</div>
</div>
Server List
{% endblock pageheader %}
{% block body %}

View File

@ -1,9 +1,13 @@
{% extends "base.htm" %}
{% block pageheader %}
Zone listing for {{ zone_name }}
{% endblock pageheader %}
{% block body %}
{% if not errors %}
<table>
<table class="table">
<tr>
<th></th>
<th>Name</th>