diff --git a/apps/workerslocation/views/views_main.py b/apps/workerslocation/views/views_main.py index a5a06ad..072b7c3 100644 --- a/apps/workerslocation/views/views_main.py +++ b/apps/workerslocation/views/views_main.py @@ -219,9 +219,9 @@ def map_index(request): @never_cache def main_index(request): try: - wlocation_module = settingsmodule.get_settings('wlocationsystem','') - if wlocation_module == 'Radiusip': - return views_radiusapi.map_index(request) + context = generalmodule.get_context_template() + if context['wlocationsystem'] == 'Radiusip': + return views_radiusapi.map_index(request, context) lon = str(float(settingsmodule.get_settings('longitude', '86.10111978605353'))) # долгота центра lat = str(float(settingsmodule.get_settings('latitude', '55.344251210827814'))) # широта @@ -255,7 +255,7 @@ def main_index(request): next_url='page={}'.format(page.next_page_number()) else: next_url='' - context = generalmodule.get_context_template() + context.update({ 'page_object' : page, 'is_paginated':page.has_other_pages(), diff --git a/apps/workerslocation/views/views_radiusapi.py b/apps/workerslocation/views/views_radiusapi.py index 5a995e1..6f8d02c 100644 --- a/apps/workerslocation/views/views_radiusapi.py +++ b/apps/workerslocation/views/views_radiusapi.py @@ -16,16 +16,15 @@ from apps.general.views import settingsmodule @login_required(login_url='/') @never_cache -def map_index(request): +def map_index(request, context): try: lon = str(float(settingsmodule.get_settings('longitude', '86.10111978605353'))) # долгота центра lat = str(float(settingsmodule.get_settings('latitude', '55.344251210827814'))) # широта - - return render(request, 'wklocation_map.html', - { - 'lon': lon.replace(',', '.'), - 'lat': lat.replace(',', '.'), - }) + context.update({ + 'lon': lon.replace(',', '.'), + 'lat': lat.replace(',', '.'), + }) + return render(request, 'wklocation_map.html', context) except Exception as err: logging.error(traceback.format_exc()) @@ -42,7 +41,8 @@ def update_object(request): 'longitude': worker.longitude, 'velocity': worker.velocity, 'radius': worker.radius, - 'update_time': worker.update_time.astimezone(zoneinfo.ZoneInfo(settings.TIME_ZONE)).strftime('%d.%m.%Y, %H:%M:%S'), + 'update_time': worker.update_time.astimezone(zoneinfo.ZoneInfo(settings.TIME_ZONE)).strftime( + '%d.%m.%Y, %H:%M:%S'), }) return JsonResponse(workers_mas, safe=False) except Exception as err: