PenParse/penparse/webui/views.py

48 lines
1.0 KiB
Python

import logging
from django.contrib import messages
from django.shortcuts import redirect, render
from django.http import HttpRequest, HttpResponse
from django import conf, forms
from .models import User
from .forms import RegisterForm
logger = logging.getLogger(__name__)
def index(request):
# return HttpResponse("Hello, world. You're at the polls index.")
return render(request, 'index.html')
def dashboard(request):
return render(request, 'dashboard.html')
def settings(request):
return render(request, 'settings.html')
def upload_document(request):
return render(request, 'upload.html')
def register(request: HttpRequest):
# if the form is not submitted yet, return the form
if request.method == 'POST':
form = RegisterForm(request.POST)
if form.is_valid():
form.save()
messages.success(request, 'Registration successful!')
return redirect('login')
else:
form = RegisterForm()
return render(request, 'register.html', {'form': form})