Исправил баг с зачеркиванием wlocation

This commit is contained in:
zakhy 2024-11-02 12:42:12 +07:00
parent 2439397415
commit 30b202c28b
2 changed files with 12 additions and 12 deletions

View File

@ -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(),

View File

@ -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: