WIP: Initial instrumentation of delete record functionality.
I have the confirmation page written. Need to work on parsing array to delete when confirmation received.
This commit is contained in:
parent
23321a8a4c
commit
6dd125eb67
|
@ -83,3 +83,31 @@ def add_record_result(request):
|
||||||
return render_to_response('bcommon/add_record_result.htm',
|
return render_to_response('bcommon/add_record_result.htm',
|
||||||
{ 'response' : response },
|
{ 'response' : response },
|
||||||
context_instance=RequestContext(request))
|
context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
def view_delete_record(request):
|
||||||
|
if request.method == "GET":
|
||||||
|
# Return home. You shouldn't trying to directly acces
|
||||||
|
# the url for deleting records.
|
||||||
|
return redirect('/')
|
||||||
|
|
||||||
|
rr_server = request.POST['rr_server']
|
||||||
|
rr_domain = request.POST['rr_domain']
|
||||||
|
rr_array = request.POST.getlist('rr_array')
|
||||||
|
|
||||||
|
if request.POST['delete_step'] == "initial":
|
||||||
|
""" We need to confirm they really want to delete the items. """
|
||||||
|
return render_to_response('bcommon/delete_record_initial.htm',
|
||||||
|
{ 'rr_server' : rr_server,
|
||||||
|
'rr_domain' : rr_domain,
|
||||||
|
'rr_array' : rr_array },
|
||||||
|
context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
if request.POST['delete_step'] == "finalize":
|
||||||
|
# TODO: Instrument
|
||||||
|
""" Time to actually delete the records requested """
|
||||||
|
pass
|
||||||
|
|
||||||
|
# If we hit a case where we don't know what's going on.
|
||||||
|
return render_to_response('bcommon/index.htm',
|
||||||
|
{ 'errors' : "We hit an unhandled exception in deleting your requested records." },
|
||||||
|
context_instance=RequestContext(request))
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{% extends "base.htm" %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<form action="/delete_record/" method="POST">{% csrf_token %}
|
||||||
|
<input type="hidden" name="rr_server" value="{{ rr_server }}">
|
||||||
|
<input type="hidden" name="rr_domain" value="{{ rr_domain }}">
|
||||||
|
<input type="hidden" name="rr_array" value="{{ rr_array }}">
|
||||||
|
<input type="hidden" name="delete_step" value="finalize">
|
||||||
|
Do you really want to delete the following records?
|
||||||
|
<ul>
|
||||||
|
<li>Server: {{ rr_server }}</li>
|
||||||
|
<li>Domain: {{ rr_domain }}</li>
|
||||||
|
<li>Records: {{ rr_array }}</li>
|
||||||
|
</ul>
|
||||||
|
<input type="submit" value="Yes, I really want to really them."/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock body %}
|
|
@ -12,9 +12,10 @@
|
||||||
<th>Data</th>
|
<th>Data</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<form action="/modify/delete_record" method="post">
|
<form action="/delete_record/" method="post">{% csrf_token %}
|
||||||
<input type="hidden" name="rr_domain" value="{{ rr_domain }}">
|
|
||||||
<input type="hidden" name="rr_server" value="{{ rr_server }}">
|
<input type="hidden" name="rr_server" value="{{ rr_server }}">
|
||||||
|
<input type="hidden" name="rr_domain" value="{{ rr_domain }}">
|
||||||
|
<input type="hidden" name="delete_step" value="initial">
|
||||||
{% for current_record in record_array %}
|
{% for current_record in record_array %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="checkbox" name="rr_array" value="{{ current_record.rr_name }}"></td>
|
<td><input type="checkbox" name="rr_array" value="{{ current_record.rr_name }}"></td>
|
||||||
|
|
|
@ -13,6 +13,7 @@ urlpatterns = patterns('',
|
||||||
(r'^info/(?P<dns_hostname>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'bcommon.views.view_zone_records'),
|
(r'^info/(?P<dns_hostname>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'bcommon.views.view_zone_records'),
|
||||||
(r'^add_record/(?P<dns_hostname>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'bcommon.views.view_add_record'),
|
(r'^add_record/(?P<dns_hostname>[a-zA-Z0-9.-]+)/(?P<zone_name>[a-zA-Z0-9.-]+)/$', 'bcommon.views.view_add_record'),
|
||||||
(r'^add_record/result/$', 'bcommon.views.add_record_result'),
|
(r'^add_record/result/$', 'bcommon.views.add_record_result'),
|
||||||
|
(r'^delete_record/$', 'bcommon.views.view_delete_record'),
|
||||||
)
|
)
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
|
Loading…
Reference in New Issue