8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-06-02 07:52:23 +00:00

Add some comments

This commit is contained in:
Yohann D'ANELLO 2021-02-01 03:49:19 +01:00
parent 539517eed0
commit bc62fc7e20
No known key found for this signature in database
GPG key ID: 3A75C55819C8CF85
5 changed files with 40 additions and 4 deletions

View file

@ -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

View file

@ -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 %}

View file

@ -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 %}

View file

@ -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

View file

@ -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):