Commit ce550ee5 authored by Rachana's avatar Rachana

Replaced delete_group ajax call with reg view. Redirects to home group after deletion

parent 87de0fc1
......@@ -339,7 +339,7 @@
{% endif %}
</a>
{% if node %}
<a class="tiny button radius delete-btn right-btn" title="{% trans 'Delete' %}">
<a class="tiny button radius delete-btn grp_delete right-btn" title="{% trans 'Delete' %}">
{% if group_object.agency_type == 'Partner' %}
{% trans 'Delete Partner' %}
{% else %}
......@@ -535,22 +535,12 @@
});
{% elif "Group" in node.member_of_names_list %}
$.ajax({
type: "POST",
url: "{% url 'delete_group' group_object.pk %}",
datatype: "html",
data:{
csrfmiddlewaretoken: '{{ csrf_token }}'
},
success: function(data) {
window.location.replace("{% url 'groupchange' 'home' %}");
}
$(".grp_delete").attr('href', "{% url 'delete_group' group_object.pk %}")
$(".grp_delete")[0].click()
{% endif %}
});
{% endif %}
});
$(document).on("click", "#btnConfirmNo", function() {
......
......@@ -68,15 +68,10 @@ def trash_resource(request,group_id,node_id):
@get_execution_time
# @staff_required
def delete_group(request,group_id):
response_dict = {'success': False}
try:
if group_id:
del_s,del_msg = delete_node(ObjectId(group_id),deletion_type=0)
if del_s:
response_dict['success'] = True
except Exception as e:
pass
return HttpResponse(json.dumps(response_dict))
response_dict = {'success': False}
del_s,del_msg = delete_node(ObjectId(group_id),deletion_type=0)
if del_s:
return HttpResponseRedirect(reverse('groupchange', kwargs={'group_id': 'home'}))
@get_execution_time
def delete_resource(request,group_id):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment