diff --git a/portail/apps.py b/portail/apps.py index 47cc605f..3d8e0cca 100644 --- a/portail/apps.py +++ b/portail/apps.py @@ -23,6 +23,12 @@ This app provides a clean way to make a subscription, to make a captive portal. This is only sugar, this does not provide any model. + +To use this app, simply install the app into the Django project +(this is completely optional), then configure your reverse proxy +to redirect all requests to /portail/. +The app provides new views to sign in and buy articles, to avoid +accessing to the full Re2o. """ from django.apps import AppConfig diff --git a/portail/templates/portail/index.html b/portail/templates/portail/index.html index d4892317..18a2eab2 100644 --- a/portail/templates/portail/index.html +++ b/portail/templates/portail/index.html @@ -1,3 +1,5 @@ +{% extends "base.html" %} + {% comment %} Re2o est un logiciel d'administration développé initiallement au Rézo Metz. Il se veut agnostique au réseau considéré, de manière à être installable en @@ -20,8 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. {% endcomment %} -{% extends "base.html" %} - {% load i18n %} {% block content %} diff --git a/portail/templates/portail/signup.html b/portail/templates/portail/signup.html index 2e9bf1c1..56b3dad7 100644 --- a/portail/templates/portail/signup.html +++ b/portail/templates/portail/signup.html @@ -1,3 +1,5 @@ +{% extends "base.html" %} + {% comment %} Re2o est un logiciel d'administration développé initiallement au Rézo Metz. Il se veut agnostique au réseau considéré, de manière à être installable en @@ -20,8 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. {% endcomment %} -{% extends "base.html" %} - {% load bootstrap3 i18n %} {% block custom_js %} diff --git a/portail/urls.py b/portail/urls.py index 6548e296..2fdc8c3e 100644 --- a/portail/urls.py +++ b/portail/urls.py @@ -23,6 +23,12 @@ This app provides a clean way to make a subscription, to make a captive portal. This is only sugar, this does not provide any model. + +To use this app, simply install the app into the Django project +(this is completely optional), then configure your reverse proxy +to redirect all requests to /portail/. +The app provides new views to sign in and buy articles, to avoid +accessing to the full Re2o. """ from cotisations.views import new_facture diff --git a/portail/views.py b/portail/views.py index f52fa1b5..07d81fcf 100644 --- a/portail/views.py +++ b/portail/views.py @@ -18,6 +18,18 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +""" +This app provides a clean way to make a subscription, +to make a captive portal. + +This is only sugar, this does not provide any model. + +To use this app, simply install the app into the Django project +(this is completely optional), then configure your reverse proxy +to redirect all requests to /portail/. +The app provides new views to sign in and buy articles, to avoid +accessing to the full Re2o. +""" from cotisations.models import Facture, Vente from cotisations.utils import find_payment_method @@ -31,6 +43,9 @@ from .forms import AdherentForm, MembershipForm class SignUpView(CreateView): + """ + Enable users to sign up and automatically buy a new membership and a connection. + """ form_class = AdherentForm template_name = "portail/signup.html" @@ -41,6 +56,9 @@ class SignUpView(CreateView): @transaction.atomic def form_valid(self, form): + """ + When the registration form is submitted, a new account is created and a membership is bought. + """ membership_form = MembershipForm(self.request.POST or None) if not membership_form.is_valid(): @@ -48,9 +66,11 @@ class SignUpView(CreateView): form.save() + # Login automatically into the new account user = form.instance login(self.request, form.instance) + # Buy the new membership payment_method = membership_form.cleaned_data["payment_method"] article = membership_form.cleaned_data["article"] @@ -80,6 +100,7 @@ class SignUpView(CreateView): super().form_valid(form) # POOP CODE, pliz Re2o + # End the payment process, it mays redirect to ComNPay return payment_method.end_payment(invoice, self.request) def get_success_url(self): @@ -87,6 +108,9 @@ class SignUpView(CreateView): class IndexView(TemplateView): + """ + Custom index page for the captive portal. + """ template_name = "portail/index.html" def get_context_data(self, **kwargs):