From 81e04195ba4f72df1be0e1a5c6f758f1407b03fa Mon Sep 17 00:00:00 2001 From: zakhy <=> Date: Wed, 16 Apr 2025 16:02:29 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/workerslocation/templates/wklocation_map.html | 2 +- apps/workerslocation/views/views_radiusapi.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/workerslocation/templates/wklocation_map.html b/apps/workerslocation/templates/wklocation_map.html index cd49be8..1e13bd0 100644 --- a/apps/workerslocation/templates/wklocation_map.html +++ b/apps/workerslocation/templates/wklocation_map.html @@ -177,7 +177,7 @@ // Функция для обновления маркеров async function updateMarkers() { // Обновление работников - const workersData = await fetch('/wklocation/update_object/') + const workersData = await fetch('/wklocation/update_object/?all=true') .then(r => r.json()); const workersDataActive = workersData.filter(el => el.active) diff --git a/apps/workerslocation/views/views_radiusapi.py b/apps/workerslocation/views/views_radiusapi.py index c13b06e..8f6d062 100644 --- a/apps/workerslocation/views/views_radiusapi.py +++ b/apps/workerslocation/views/views_radiusapi.py @@ -69,8 +69,10 @@ def update_object(request, pk=None): date_start = datetime.now() - timedelta(days=1) if pk: workers = WorkersLocation.objects.filter(id=pk) - else: + elif request.GET.get("all") == "true": workers = WorkersLocation.objects.all() + else: + workers = WorkersLocation.objects.filter(active=True) workers_mas = [] for worker in workers: worker_name = worker.name if worker.name else worker.uid