diff --git a/main/templates/main/help.html b/main/templates/main/help.html new file mode 100644 index 0000000..356b71f --- /dev/null +++ b/main/templates/main/help.html @@ -0,0 +1,5 @@ +{% extends "main/base.html" %} +{% block content %} +

Help

+

This is the help page.

+{% endblock content %} diff --git a/main/templates/main/navbar.html b/main/templates/main/navbar.html index 256741c..9470c58 100644 --- a/main/templates/main/navbar.html +++ b/main/templates/main/navbar.html @@ -22,6 +22,16 @@ {% endif %} + diff --git a/main/urls.py b/main/urls.py index 33fa5d0..3d908fa 100644 --- a/main/urls.py +++ b/main/urls.py @@ -8,4 +8,5 @@ urlpatterns = [ path("", views.index, name="index"), path("accounts/", include("django.contrib.auth.urls")), + path("help/", views.HelpView.as_view(), name="help"), ] diff --git a/main/views.py b/main/views.py index d859bf5..a3a2e6a 100644 --- a/main/views.py +++ b/main/views.py @@ -3,9 +3,18 @@ from django.contrib.auth.decorators import login_required from django.http import HttpRequest, HttpResponse from django.shortcuts import render +from django.views import View @login_required def index(request: HttpRequest) -> HttpResponse: """View that renders the index/home page.""" return render(request=request, template_name="main/index.html") + + +class HelpView(View): + """View that renders the help page.""" + + def get(self, request: HttpRequest) -> HttpResponse: + """Render the help page.""" + return render(request=request, template_name="main/help.html") diff --git a/tests/main/test_views.py b/tests/main/test_views.py index efa8274..a10f4cc 100644 --- a/tests/main/test_views.py +++ b/tests/main/test_views.py @@ -38,3 +38,11 @@ def test_index_view_authenticated(self, auth_client): response, f'Controller', # noqa: E501 ) + + def test_help_view(self, auth_client): + """Test that the help view is rendered.""" + response = auth_client.get(reverse("main:help")) + assert response.status_code == HTTPStatus.OK + assertTemplateUsed(response, "main/help.html") + assertContains(response, "

Help

") + assertContains(response, "This is the help page.")