From 32cdd065d317a262395a3269218990586d7b68be Mon Sep 17 00:00:00 2001 From: Ethan Nguyen Date: Tue, 20 Apr 2021 14:27:31 -0400 Subject: [PATCH] chore: use TemplateView instead of function view --- tjdests/apps/authentication/urls.py | 2 +- tjdests/apps/authentication/views.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tjdests/apps/authentication/urls.py b/tjdests/apps/authentication/urls.py index e1a6873..e59629a 100644 --- a/tjdests/apps/authentication/urls.py +++ b/tjdests/apps/authentication/urls.py @@ -6,7 +6,7 @@ from . import views app_name = "authentication" urlpatterns = [ - path("", views.index_view, name="index"), + path("", views.IndexView.as_view(), name="index"), path("login", views.LoginViewCustom.as_view(), name="login"), path("logout", LogoutView.as_view(), name="logout"), path("tos", views.accept_tos_view, name="tos"), diff --git a/tjdests/apps/authentication/views.py b/tjdests/apps/authentication/views.py index 717e9bb..24bd3e5 100644 --- a/tjdests/apps/authentication/views.py +++ b/tjdests/apps/authentication/views.py @@ -5,12 +5,13 @@ from django.contrib.auth.views import LoginView from django.http import HttpRequest, HttpResponse from django.shortcuts import redirect, render from django.urls import reverse +from django.views.generic import TemplateView from tjdests.apps.authentication.forms import TOSForm -def index_view(request: HttpRequest) -> HttpResponse: - return render(request, "authentication/index.html") +class IndexView(TemplateView): + template_name = "authentication/index.html" @login_required