добавил статус уровня воды "не изменяется"
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import os
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render
|
||||
# from django.db.models import Manager
|
||||
from django.contrib.auth import authenticate, login
|
||||
|
||||
# только для тестирования!
|
||||
import requests
|
||||
@@ -12,6 +13,10 @@ TEST_BASE_FETCH = "https://test.wawaa.ru/dev-fetch.php"
|
||||
|
||||
def view_index(request):
|
||||
return render(request, 'index.html')
|
||||
# if request.user.is_authenticated:
|
||||
# return render(request, 'index.html')
|
||||
# else:
|
||||
# return HttpResponseRedirect()
|
||||
|
||||
|
||||
def view_stats(request):
|
||||
@@ -29,3 +34,19 @@ def view_tank_chart(request):
|
||||
response = HttpResponse(res.content)
|
||||
response.headers["Content-type"] = response.headers["Content-type"]
|
||||
return response
|
||||
|
||||
|
||||
# вход
|
||||
|
||||
|
||||
def view_login(request):
|
||||
username = request.POST["username"]
|
||||
password = request.POST["password"]
|
||||
user = authenticate(request, username=username, password=password)
|
||||
if user is not None:
|
||||
login(request, user)
|
||||
return HttpResponseRedirect('/')
|
||||
else:
|
||||
# Return an 'invalid login' error message.
|
||||
pass
|
||||
|
||||
|
Reference in New Issue
Block a user