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) ttl = forms.ChoiceField(choices=TTL_CHOICES, label="TTL", initial=86400)
create_reverse = forms.BooleanField(label="Create Reverse Record (PTR)?", required=False) create_reverse = forms.BooleanField(label="Create Reverse Record (PTR)?", required=False)
data = forms.CharField(max_length=256, label="Record Data (IP/Hostname)") 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. """Add a DNS record with data from a FormAddRecord object.
If a reverse PTR record is requested, this will be added too.""" 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"]) keyring = create_keyring(form_data["key_name"])
except Exception, err: else:
raise Exception("Error creating keyring in add_record: %s" % err) keyring = None
response = {} response = {}
forward_response = add_forward_record(form_data, keyring) forward_response = add_forward_record(form_data, keyring)

View File

@ -25,8 +25,16 @@
<body> <body>
<script src="http://code.jquery.com/jquery.js"></script> <script src="http://code.jquery.com/jquery.js"></script>
<script src="/files/static/bootstrap/js/bootstrap.min.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 %} {% block pageheader %}
{% endblock pageheader %} {% endblock pageheader %}
</a>
</div>
</div>
{% block errors %} {% block errors %}

View File

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

View File

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

View File

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

View File

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