Dashboard view to template

This commit is contained in:
Corban-Lee Jones 2024-03-06 16:01:46 +00:00
parent 2691380f81
commit c9e47e3e9e
2 changed files with 8 additions and 5 deletions

View File

@ -4,14 +4,14 @@ from django.urls import path, include
from django.shortcuts import redirect
from apps.home import views
from .views import TicketView
from .views import DashboardView, TicketView
def reverse_to_index(reqeust):
return redirect("dashboard")
urlpatterns = [
path("", reverse_to_index, name="index"),
path('dashboard/', views.dashboard, name="dashboard"),
path('dashboard/', DashboardView.as_view(), name="dashboard"),
path('tickets/', include([
path('', TicketView.as_view(), name="tickets"),
path('new/', views.new_ticket, name="ticket-new"),

View File

@ -19,9 +19,12 @@ from ..authentication.models import Department
from .models import Ticket, TicketPriority, TicketTag
@login_required()
def dashboard(request):
return render(request, "home/dashboard.html")
class DashboardView(TemplateView):
template_name = "home/dashboard.html"
@method_decorator(login_required)
def get(self, request, *args, **kwargs):
return render(request, self.template_name)
class TicketView(TemplateView):