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