From 6662e65c08a990c30dc03285fe7ebedb45e3926b Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 21 Jul 2022 13:46:34 +0100 Subject: [PATCH] Begin work on Drilldown implementation --- app/urls.py | 3 ++- core/ui/views/drilldown.py | 12 ++++++++++++ core/views.py | 6 ------ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 core/ui/views/drilldown.py diff --git a/app/urls.py b/app/urls.py index 2ff65c2..77dbe3e 100644 --- a/app/urls.py +++ b/app/urls.py @@ -16,7 +16,8 @@ Including another URLconf from django.contrib import admin from django.urls import include, path -from core.views import Drilldown, Home, Profile, Signup +from core.views import Home, Profile, Signup +from core.ui.views.drilldown import Drilldown urlpatterns = [ path("", Home.as_view(), name="home"), diff --git a/core/ui/views/drilldown.py b/core/ui/views/drilldown.py new file mode 100644 index 0000000..2716ebe --- /dev/null +++ b/core/ui/views/drilldown.py @@ -0,0 +1,12 @@ +from django.contrib.auth.mixins import LoginRequiredMixin +from django.views import View +from django.shortcuts import render + + +class Drilldown(LoginRequiredMixin, View): + template_name = "ui/drilldown.html" + + def get(self, request, *args, **kwargs): + if not request.user.has_plan("drilldown"): + return render(request, "denied.html") + return render(request, self.template_name) \ No newline at end of file diff --git a/core/views.py b/core/views.py index d5e8ce8..ffde810 100644 --- a/core/views.py +++ b/core/views.py @@ -9,13 +9,7 @@ from core.forms import NewUserForm # Create your views here -class Drilldown(LoginRequiredMixin, View): - template_name = "ui/drilldown.html" - def get(self, request, *args, **kwargs): - if not request.user.has_plan("drilldown"): - return render(request, "denied.html") - return render(request, self.template_name) class Home(View):