большое обновление фронта

This commit is contained in:
2024-01-03 12:38:37 +03:00
parent 4c94a7271a
commit a1f86691a4
9 changed files with 333 additions and 200 deletions

View File

@@ -19,5 +19,7 @@ from . import views
urlpatterns = [
path('', views.view_index, name='index'),
path('fetch/stats', views.view_stats, name='fetch-stats'),
path('fetch/tank-chart', views.view_tank_chart, name='fetch-tank-chart'),
# path('methods/<str:method_name>', views.call_method, name='call_method')
]

View File

@@ -1,8 +1,30 @@
import os
from django.http import HttpResponse
from django.shortcuts import render
from django.db.models import Manager
# Create your views here.
# только для тестирования!
import requests
TEST_BASE_FETCH = "https://test.wawaa.ru/dev-fetch.php"
def view_index(request):
return render(request, 'index.html')
def view_stats(request):
# только для тестирования!
res = requests.get(TEST_BASE_FETCH + "?stats", headers={'Authorization': os.getenv("TEST_AUTH")})
response = HttpResponse(res.content)
response.headers["Content-type"] = response.headers["Content-type"]
return response
def view_tank_chart(request):
# только для тестирования!
res = requests.get(TEST_BASE_FETCH + "?tank_chart", headers={'Authorization': os.getenv("TEST_AUTH")})
response = HttpResponse(res.content)
response.headers["Content-type"] = response.headers["Content-type"]
return response