add url and view handler for sysconfig apply, <TESTED - WORKS>
This commit is contained in:
@@ -12,7 +12,7 @@ from .models import user_model
|
||||
from .utils.html_parser import get_logs, get_profiles
|
||||
import json
|
||||
from .utils.statistics import count_clients, count_traffic, count_connection, count_percentage, count_broken
|
||||
from .utils.reqs_handler import req_edit_state, req_edit_user
|
||||
from .utils.reqs_handler import req_edit_state, req_edit_user, req_apply_sys
|
||||
from django.middleware.csrf import get_token
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
@@ -283,6 +283,16 @@ def wgViewClients(request):
|
||||
|
||||
return HttpResponse(final_data, content_type='application')
|
||||
|
||||
def get_ApplyConfig(request):
|
||||
|
||||
# id = request.GET.get('id', '')
|
||||
# state = request.GET.get('state', '')
|
||||
# print("Edit Request...")
|
||||
|
||||
req_response = req_apply_sys()
|
||||
|
||||
return HttpResponse(req_response)
|
||||
|
||||
def get_EditState(request):
|
||||
|
||||
id = request.GET.get('id', '')
|
||||
@@ -297,7 +307,14 @@ def get_EditState(request):
|
||||
|
||||
req_edit_state(id, state)
|
||||
else:
|
||||
print(id)
|
||||
print("[ Bulk handler ]=======")
|
||||
print(request.body)
|
||||
|
||||
target_ids = request.body
|
||||
|
||||
for x in json.loads(target_ids):
|
||||
req_edit_state(str(x), state)
|
||||
print(x)
|
||||
|
||||
final_data = json.dumps({"state":"Success"})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user