mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
Add some comments
This commit is contained in:
parent
539517eed0
commit
bc62fc7e20
5 changed files with 40 additions and 4 deletions
|
@ -23,6 +23,12 @@ This app provides a clean way to make a subscription,
|
||||||
to make a captive portal.
|
to make a captive portal.
|
||||||
|
|
||||||
This is only sugar, this does not provide any model.
|
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
|
from django.apps import AppConfig
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% comment %}
|
{% comment %}
|
||||||
Re2o est un logiciel d'administration développé initiallement au Rézo Metz. Il
|
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
|
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.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% comment %}
|
{% comment %}
|
||||||
Re2o est un logiciel d'administration développé initiallement au Rézo Metz. Il
|
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
|
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.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% load bootstrap3 i18n %}
|
{% load bootstrap3 i18n %}
|
||||||
|
|
||||||
{% block custom_js %}
|
{% block custom_js %}
|
||||||
|
|
|
@ -23,6 +23,12 @@ This app provides a clean way to make a subscription,
|
||||||
to make a captive portal.
|
to make a captive portal.
|
||||||
|
|
||||||
This is only sugar, this does not provide any model.
|
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
|
from cotisations.views import new_facture
|
||||||
|
|
|
@ -18,6 +18,18 @@
|
||||||
# You should have received a copy of the GNU General Public License along
|
# 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.,
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 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.models import Facture, Vente
|
||||||
from cotisations.utils import find_payment_method
|
from cotisations.utils import find_payment_method
|
||||||
|
@ -31,6 +43,9 @@ from .forms import AdherentForm, MembershipForm
|
||||||
|
|
||||||
|
|
||||||
class SignUpView(CreateView):
|
class SignUpView(CreateView):
|
||||||
|
"""
|
||||||
|
Enable users to sign up and automatically buy a new membership and a connection.
|
||||||
|
"""
|
||||||
form_class = AdherentForm
|
form_class = AdherentForm
|
||||||
template_name = "portail/signup.html"
|
template_name = "portail/signup.html"
|
||||||
|
|
||||||
|
@ -41,6 +56,9 @@ class SignUpView(CreateView):
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def form_valid(self, form):
|
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)
|
membership_form = MembershipForm(self.request.POST or None)
|
||||||
|
|
||||||
if not membership_form.is_valid():
|
if not membership_form.is_valid():
|
||||||
|
@ -48,9 +66,11 @@ class SignUpView(CreateView):
|
||||||
|
|
||||||
form.save()
|
form.save()
|
||||||
|
|
||||||
|
# Login automatically into the new account
|
||||||
user = form.instance
|
user = form.instance
|
||||||
login(self.request, form.instance)
|
login(self.request, form.instance)
|
||||||
|
|
||||||
|
# Buy the new membership
|
||||||
payment_method = membership_form.cleaned_data["payment_method"]
|
payment_method = membership_form.cleaned_data["payment_method"]
|
||||||
article = membership_form.cleaned_data["article"]
|
article = membership_form.cleaned_data["article"]
|
||||||
|
|
||||||
|
@ -80,6 +100,7 @@ class SignUpView(CreateView):
|
||||||
super().form_valid(form)
|
super().form_valid(form)
|
||||||
|
|
||||||
# POOP CODE, pliz Re2o
|
# POOP CODE, pliz Re2o
|
||||||
|
# End the payment process, it mays redirect to ComNPay
|
||||||
return payment_method.end_payment(invoice, self.request)
|
return payment_method.end_payment(invoice, self.request)
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
|
@ -87,6 +108,9 @@ class SignUpView(CreateView):
|
||||||
|
|
||||||
|
|
||||||
class IndexView(TemplateView):
|
class IndexView(TemplateView):
|
||||||
|
"""
|
||||||
|
Custom index page for the captive portal.
|
||||||
|
"""
|
||||||
template_name = "portail/index.html"
|
template_name = "portail/index.html"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue