diff --git a/binder/bcommon/views.py b/binder/bcommon/views.py index 19d6788..e00e52a 100644 --- a/binder/bcommon/views.py +++ b/binder/bcommon/views.py @@ -83,3 +83,31 @@ def add_record_result(request): return render_to_response('bcommon/add_record_result.htm', { 'response' : response }, 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)) diff --git a/binder/templates/bcommon/delete_record_initial.htm b/binder/templates/bcommon/delete_record_initial.htm new file mode 100644 index 0000000..698f26c --- /dev/null +++ b/binder/templates/bcommon/delete_record_initial.htm @@ -0,0 +1,19 @@ +{% extends "base.htm" %} + +{% block body %} + +
{% csrf_token %} + + + + +Do you really want to delete the following records? + + +
+ +{% endblock body %} diff --git a/binder/templates/bcommon/list_zone.htm b/binder/templates/bcommon/list_zone.htm index 7288a79..933dc83 100644 --- a/binder/templates/bcommon/list_zone.htm +++ b/binder/templates/bcommon/list_zone.htm @@ -12,9 +12,10 @@ Data -
- +{% csrf_token %} + + {% for current_record in record_array %} diff --git a/binder/urls.py b/binder/urls.py index fae8f9d..e289198 100644 --- a/binder/urls.py +++ b/binder/urls.py @@ -13,6 +13,7 @@ urlpatterns = patterns('', (r'^info/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/$', 'bcommon.views.view_zone_records'), (r'^add_record/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/$', 'bcommon.views.view_add_record'), (r'^add_record/result/$', 'bcommon.views.add_record_result'), + (r'^delete_record/$', 'bcommon.views.view_delete_record'), ) if settings.DEBUG: