diff --git a/config/urls.py b/config/urls.py index cd24888d..aacc97b0 100644 --- a/config/urls.py +++ b/config/urls.py @@ -5,26 +5,23 @@ from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.urls import include, path from django.views import defaults as default_views -from django.views.generic import TemplateView from rest_framework.authtoken.views import obtain_auth_token +from pepfar_mle.common.views import AboutView, HomeView + urlpatterns = [ - path("", TemplateView.as_view(template_name="pages/home.html"), name="home"), + path("", HomeView.as_view(), name="home"), path( "about/", - TemplateView.as_view(template_name="pages/about.html"), + AboutView.as_view(), name="about", ), - # path( - # "jet/dashboard/", include("jet.dashboard.urls", "jet-dashboard") - # ), # Django JET dashboard URLS path("jet/", include("jet.urls", "jet")), # Django JET URLS # Django Admin, use {% url 'admin:index' %} path(settings.ADMIN_URL, admin.site.urls), # User management path("users/", include("pepfar_mle.users.urls", namespace="users")), path("accounts/", include("allauth.urls")), - # Your stuff: custom urls includes go here ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.DEBUG: # Static file serving when using Gunicorn + Uvicorn for local web socket development diff --git a/pepfar_mle/common/views.py b/pepfar_mle/common/views.py index e69de29b..bba01e01 100644 --- a/pepfar_mle/common/views.py +++ b/pepfar_mle/common/views.py @@ -0,0 +1,10 @@ +from django.contrib.auth.mixins import LoginRequiredMixin +from django.views.generic import TemplateView + + +class HomeView(LoginRequiredMixin, TemplateView): + template_name = "pages/home.html" + + +class AboutView(LoginRequiredMixin, TemplateView): + template_name = "pages/about.html"