Формат даты

This commit is contained in:
zakhy 2025-01-28 12:43:52 +07:00
parent d432520ce7
commit f6f6f7d201

View File

@ -1,5 +1,6 @@
import json
import traceback
import datetime
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
@ -16,9 +17,16 @@ def update_list(request):
context = generalmodule.get_context_template()
with open('update_info.json') as file:
updates = json.load(file)
updates = map(convert_to_local_format, updates)
context.update({
"updates": updates
})
return render(request, 'update_list.html', context)
except Exception as err:
logging.error(traceback.format_exc())
def convert_to_local_format(obj):
data_obj = datetime.datetime.fromisoformat(obj['date_release'])
obj['date_release'] = data_obj.strftime("%d.%m.%Y")
return obj