PenParse/penparse/webui/views/__init__.py

62 lines
1.3 KiB
Python
Raw Normal View History

2024-12-08 15:51:02 +00:00
import logging
import os
from django.contrib import messages
from django.shortcuts import redirect, render
from django.http import HttpRequest
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from ..models import ImageMemo
from django.contrib.auth.decorators import login_required
logger = logging.getLogger(__name__)
from .thumbnail import document_thumbnail
from .register import register
from .upload import upload_document
2024-12-08 15:51:02 +00:00
def index(request):
# return HttpResponse("Hello, world. You're at the polls index.")
return render(request, "index.html")
__all__ = [
"index",
"document_thumbnail",
"register",
"dashboard",
"settings",
"view_document",
"download_document",
"upload_document",
]
2024-12-08 15:51:02 +00:00
@login_required
def dashboard(request: HttpRequest):
documents = ImageMemo.objects.filter(author__id=request.user.id).order_by(
"-updated_at"
)
context = {"documents": documents}
return render(request, "dashboard.html", context)
@login_required
def settings(request):
return render(request, "settings.html")
@login_required
def view_document(request):
return render(request, "document.html")
@login_required
def download_document(request):
return render(request, "document.html")