From 23e166451efaf3390f4376e14e5d87cb68ab4b80 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Mon, 31 Oct 2022 17:50:56 +0100 Subject: [PATCH] Add landing page --- src/common/templates/common/hello-random.html | 1 - src/common/templates/common/hello.html | 17 +++++++++++++++++ src/common/views.py | 6 ++++-- 3 files changed, 21 insertions(+), 3 deletions(-) delete mode 100644 src/common/templates/common/hello-random.html create mode 100644 src/common/templates/common/hello.html diff --git a/src/common/templates/common/hello-random.html b/src/common/templates/common/hello-random.html deleted file mode 100644 index e20872d..0000000 --- a/src/common/templates/common/hello-random.html +++ /dev/null @@ -1 +0,0 @@ -

Hello, world! Click me - {{ value }}

diff --git a/src/common/templates/common/hello.html b/src/common/templates/common/hello.html new file mode 100644 index 0000000..bdba0a1 --- /dev/null +++ b/src/common/templates/common/hello.html @@ -0,0 +1,17 @@ +{% extends "common/base.html" %} + +{% block content %} +
+
+
+

Character Sheet

+

+ Bienvenue sur CharaSheet !
+ Vous devez vous identifier pour créer et gérer votre personnage. +

+ Créer un compte + Se connecter +
+
+
+{% endblock %} diff --git a/src/common/views.py b/src/common/views.py index 4cfd429..00dcbb4 100644 --- a/src/common/views.py +++ b/src/common/views.py @@ -1,14 +1,16 @@ from django.contrib.auth.models import Permission from django.core.handlers.wsgi import WSGIRequest from django.http import HttpResponse -from django.shortcuts import redirect +from django.shortcuts import redirect, render from django_registration.backends.activation.views import ( ActivationView as BaseActivationView, ) def hello_world(request: WSGIRequest) -> HttpResponse: - return redirect("character:list") + if request.user.is_authenticated: + return redirect("character:list") + return render(request, "common/hello.html") class ActivationView(BaseActivationView):