diff --git a/src/project/settings.py b/src/project/settings.py index 6ba6764..0135d47 100644 --- a/src/project/settings.py +++ b/src/project/settings.py @@ -28,6 +28,7 @@ INSTALLED_APPS = [ "debug_toolbar", "allauth", "allauth.account", + "utils", "accounting", "membership", ] diff --git a/src/project/templates/base.html b/src/project/templates/base.html index f200a25..6dc6a88 100644 --- a/src/project/templates/base.html +++ b/src/project/templates/base.html @@ -1,3 +1,4 @@ +{% load utils %} {% load i18n %} {% load static %} @@ -134,23 +135,52 @@
+ + + + + + + + + + + + diff --git a/src/project/templates/services_overview.html b/src/project/templates/services_overview.html new file mode 100644 index 0000000..78b07f0 --- /dev/null +++ b/src/project/templates/services_overview.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} + +{% block content %} +

+ Services and signup to these will be +

+

+ This is yet to be implemented. +

+{% endblock %} \ No newline at end of file diff --git a/src/project/urls.py b/src/project/urls.py index 2a616c7..97777ad 100644 --- a/src/project/urls.py +++ b/src/project/urls.py @@ -6,10 +6,11 @@ from django.urls import path import debug_toolbar -from . import views +from .views import index, services_overview urlpatterns = [ - path("", login_required(views.index)), + path("", login_required(index), name="index"), + path("services/", login_required(services_overview), name="services-overview"), path('accounts/', include('allauth.urls')), path("admin/", admin.site.urls), path("__debug__/", include(debug_toolbar.urls)), diff --git a/src/project/views.py b/src/project/views.py index 33e346c..38d2a74 100644 --- a/src/project/views.py +++ b/src/project/views.py @@ -3,3 +3,7 @@ from django.shortcuts import render def index(request): return render(request, "index.html") + + +def services_overview(request): + return render(request, "services_overview.html") diff --git a/src/utils/__init__.py b/src/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/utils/templatetags/__init__.py b/src/utils/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/utils/templatetags/utils.py b/src/utils/templatetags/utils.py new file mode 100644 index 0000000..07b9307 --- /dev/null +++ b/src/utils/templatetags/utils.py @@ -0,0 +1,13 @@ +from django import template +from django.urls import reverse + +register = template.Library() + + +@register.simple_tag(takes_context=True) +def active_path(context, path_name, class_name): + path = reverse(path_name) + request_path = context.get("request").path + + if path == request_path or ("basepath" in context and context["basepath"] == path): + return class_name