def login(request): if request.method == 'POST': user = request.POST.get('user') pwd = request.POST.get('pwd') if user == 'alex' and pwd == '123': return redirect(to='/index/') return render(request, 'login.html')
def index(request): return render(request, 'index.html')
def post(self, request): user = request.POST.get('user') pwd = request.POST.get('pwd') if user == 'alex' and pwd == '123': return redirect(to='/index/') return render(request, 'login.html')
def get(self, request, *args, **kwargs): return render(request, 'login.html')
def reg(request): if request.method == 'POST': user = request.POST.get('user') pwd = request.POST.get('pwd') return redirect(to='/login/') return render(request, 'reg.html')