Add landing page

This commit is contained in:
Gabriel Augendre 2022-10-31 17:50:56 +01:00
parent fec051b646
commit 23e166451e
3 changed files with 21 additions and 3 deletions

View file

@ -1 +0,0 @@
<p hx-get="{% url "hello_world" %}">Hello, world! Click me - {{ value }}</p>

View file

@ -0,0 +1,17 @@
{% extends "common/base.html" %}
{% block content %}
<div class="container mt-5">
<div class="p-5 mb-4 bg-light rounded-3">
<div class="container-fluid py-5">
<h1 class="display-5 fw-bold">Character Sheet</h1>
<p class="col-md-8 fs-4">
Bienvenue sur CharaSheet !<br>
Vous devez vous identifier pour créer et gérer votre personnage.
</p>
<a href="{% url "django_registration_register" %}" class="btn btn-primary btn-lg">Créer un compte</a>
<a href="{% url "login" %}" class="btn btn-secondary btn-lg">Se connecter</a>
</div>
</div>
</div>
{% endblock %}

View file

@ -1,14 +1,16 @@
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import redirect from django.shortcuts import redirect, render
from django_registration.backends.activation.views import ( from django_registration.backends.activation.views import (
ActivationView as BaseActivationView, ActivationView as BaseActivationView,
) )
def hello_world(request: WSGIRequest) -> HttpResponse: 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): class ActivationView(BaseActivationView):