chore: use TemplateView instead of function view

This commit is contained in:
Ethan Nguyen 2021-04-20 14:27:31 -04:00
parent 46c08db591
commit 32cdd065d3
No known key found for this signature in database
GPG Key ID: B4CA5339AF911920
2 changed files with 4 additions and 3 deletions

View File

@ -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"),

View File

@ -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