Convert template URL href references to use 'url' template syntax for reverse URLs

This commit is contained in:
Jeffrey Forman 2012-12-15 20:25:06 -05:00
parent 16a629f81a
commit a7bc198c4d
5 changed files with 12 additions and 11 deletions

View File

@ -18,7 +18,7 @@
<ul class="nav nav-list">
<li class="nav-header">Actions</li>
<li><a href="/">Home</a></li>
<li><a href="/server_list">Server List</a></li>
<li><a href="{% url server_list %}">Server List</a></li>
</ul>
{% endblock navigation %}
</div>

View File

@ -16,7 +16,7 @@ Server Zone List for {{ dns_server }}
{% for current_zone in zone_array %}
<tr>
<td>
<a href="/info/{{ dns_server }}/{{ current_zone.zone_name }}/"> {{ current_zone.zone_name }}</a>
<a href="{% url zone_list dns_server=dns_server zone_name=current_zone.zone_name %}"> {{ current_zone.zone_name }}</a>
</td>
<td>{{ current_zone.view_name }}</td>
<td>{{ current_zone.zone_class }}</td>

View File

@ -13,7 +13,7 @@ Server List
</tr>
{% for current_server in server_info %}
<tr>
<td><a href="/info/{{ current_server.host_name }}/"> {{ current_server.host_name }}</td>
<td><a href="{% url server_zone_list dns_server=current_server.host_name %}"> {{ current_server.host_name }}</td>
<td>{% for type, data in current_server.ip_address %}
{{type}}: {{data}}<br>
{% endfor %}

View File

@ -7,7 +7,7 @@ Zone listing for {{ zone_name }} on {{ dns_server }}
{% block body %}
{% if not errors %}
<form action="/delete_record/" method="post">{% csrf_token %}
<form action="{% url delete_record %}" method="post">{% csrf_token %}
<table class="table table-hover">
<tr>
<th>Select</th>
@ -36,7 +36,7 @@ Zone listing for {{ zone_name }} on {{ dns_server }}
<ul class="dropdown-menu">
<li><a href="#">Edit Record</a></li>
{% if current_record.rr_type == "A" %}
<li><a href="/add_cname/{{dns_server}}/{{zone_name}}/{{current_record.rr_name}}/">Add CNAME Pointer</a></li>
<li><a href="{% url add_cname dns_server=dns_server zone_name=zone_name record_name=current_record.rr_name %}">Add CNAME Pointer</a></li>
{% endif %}
</ul>
</div>
@ -46,7 +46,7 @@ Zone listing for {{ zone_name }} on {{ dns_server }}
{% endfor %}
<tr>
<td colspan="7"><a href="/add_record/{{ dns_server }}/{{ zone_name }}/">Add Record</a></td>
<td colspan="7"><a href="{% url add_record dns_server=dns_server zone_name=zone_name %}">Add Record</a></td>
</tr>
</table>
<input type="submit" value="Delete Selected"/>

View File

@ -1,4 +1,5 @@
from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse
from django.contrib import admin
admin.autodiscover()
@ -8,15 +9,15 @@ urlpatterns = patterns('',
url(r'^$', 'binder.views.home_index', name="index"),
url(r'^server_list/$', 'binder.views.view_server_list', name="server_list"),
url(r'^info/(?P<dns_server>[a-zA-Z0-9.-]+)/$', 'binder.views.view_server_zones', name="server_zones"),
url(r'^info/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'binder.views.view_zone_records', name="zone_records"),
url(r'^info/(?P<dns_server>[a-zA-Z0-9.-]+)/$', 'binder.views.view_server_zones', name="server_zone_list"),
url(r'^info/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'binder.views.view_zone_records', name="zone_list"),
url(r'^add_record/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'binder.views.view_add_record', name="add_record_initial"),
url(r'^add_record/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'binder.views.view_add_record', name="add_record"),
url(r'^add_record/result/$', 'binder.views.view_add_record_result', name="add_record_result"),
url(r'^delete_record/$', 'binder.views.view_delete_record', name="delete_record_initial"),
url(r'^delete_record/$', 'binder.views.view_delete_record', name="delete_record"),
url(r'^delete_record/result/$', 'binder.views.view_delete_result', name="delete_record_result"),
url(r'^add_cname/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/(?P<record_name>[a-zA-Z0-9-]+)/$', 'binder.views.view_add_cname_record', name="add_cname_initial"),
url(r'^add_cname/(?P<dns_server>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/(?P<record_name>.*?)/$', 'binder.views.view_add_cname_record', name="add_cname"),
url(r'^add_cname_record/result/$', 'binder.views.view_add_cname_result', name="add_cname_result"),
)