From b063ae783cc155fab942a387ad80c2b3904aa71f Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 1 Feb 2021 03:43:16 +0100 Subject: [PATCH] Add specific index page for the captive portal --- portail/templates/portail/index.html | 48 ++++++++++++++++++++++++++++ portail/urls.py | 3 +- portail/views.py | 12 ++++++- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 portail/templates/portail/index.html diff --git a/portail/templates/portail/index.html b/portail/templates/portail/index.html new file mode 100644 index 00000000..9fa792b9 --- /dev/null +++ b/portail/templates/portail/index.html @@ -0,0 +1,48 @@ +{% extends "base.html" %} + +{% load i18n %} + +{% block content %} +
+

{% blocktrans trimmed with asso_name=asso.name %}Welcome onto the captive portal of {{ asso_name }}!{% endblocktrans %}

+
+ +
+ {% if not user.is_authenticated %} +
+
+
+
+

{% trans "Registration" %}

+

{% trans "If you don't have an account yet and you want to access the Internet and the organisation's services, create your own personal account." %}

+

{% trans "Sign up" %}

+
+
+
+
+
+
+
+
+

{% trans "Logging in" %}

+

{% trans "If you already have an account, log in. You can manage your subscriptions to the organisation." %}

+

{% trans "Log in" %}

+
+
+
+
+ {% else %} +
+
+
+
+

{% trans "My subscriptions" %}

+

{% trans "To renew your Internet connection, you can extend your current connection." %}

+

{% trans "Buy a new subscription" %}

+
+
+
+
+ {% endif %} +
+{% endblock %} diff --git a/portail/urls.py b/portail/urls.py index 2d65a021..6548e296 100644 --- a/portail/urls.py +++ b/portail/urls.py @@ -29,9 +29,10 @@ from cotisations.views import new_facture from django.conf.urls import url from django.contrib.auth.views import LoginView -from .views import SignUpView +from .views import IndexView, SignUpView urlpatterns = [ + url(r"^$", IndexView.as_view(), name="index"), url(r"^signup/$", SignUpView.as_view(), name="signup"), url(r"^login/$", LoginView.as_view(), name="login"), url(r"^extend-connection/(?P[0-9]+)/$", new_facture, name="extend-connection"), diff --git a/portail/views.py b/portail/views.py index b0cf096a..f52fa1b5 100644 --- a/portail/views.py +++ b/portail/views.py @@ -24,7 +24,8 @@ from cotisations.utils import find_payment_method from django.contrib.auth import login from django.db import transaction from django.urls import reverse_lazy -from django.views.generic import CreateView +from django.views.generic import CreateView, TemplateView +from preferences.models import AssoOption from .forms import AdherentForm, MembershipForm @@ -83,3 +84,12 @@ class SignUpView(CreateView): def get_success_url(self): return reverse_lazy("users:profil", args=(self.object.pk,)) + + +class IndexView(TemplateView): + template_name = "portail/index.html" + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context["asso"] = AssoOption.objects.get_or_create()[0] + return context