mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 15:33:45 +00:00
Request for GTU validation
This commit is contained in:
parent
a81ede5b38
commit
1291fcd8d7
1 changed files with 22 additions and 3 deletions
|
@ -19,12 +19,13 @@
|
||||||
# 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.
|
||||||
|
|
||||||
|
from cotisations.models import Article, Paiement
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.forms import UserCreationForm
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
from preferences.models import GeneralOption
|
||||||
from cotisations.models import Article, Paiement
|
|
||||||
from re2o.widgets import AutocompleteModelWidget
|
from re2o.widgets import AutocompleteModelWidget
|
||||||
from users.models import Adherent
|
from users.models import Adherent
|
||||||
|
|
||||||
|
@ -39,10 +40,28 @@ class AdherentForm(UserCreationForm):
|
||||||
"login page or contacting support.")
|
"login page or contacting support.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Checkbox for GTU
|
||||||
|
gtu_check = forms.BooleanField(
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
gtu_file = GeneralOption.get_cached_value("GTU")
|
||||||
|
self.fields["email"].required = True
|
||||||
|
self.fields["gtu_check"].label = mark_safe(
|
||||||
|
"%s <a href='%s' download='CGU'>%s</a>."
|
||||||
|
% (
|
||||||
|
_("I commit to accept the"),
|
||||||
|
gtu_file.url if gtu_file else "#",
|
||||||
|
_("General Terms of Use"),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Adherent
|
model = Adherent
|
||||||
fields = ("name", "surname", "pseudo", "email", "telephone", "password1", "password2", "room", "school",
|
fields = ("name", "surname", "pseudo", "email", "telephone", "password1", "password2", "room", "school",
|
||||||
"former_user_check",)
|
"former_user_check", "gtu_check",)
|
||||||
widgets = {
|
widgets = {
|
||||||
"school": AutocompleteModelWidget(url="/users/school-autocomplete"),
|
"school": AutocompleteModelWidget(url="/users/school-autocomplete"),
|
||||||
"room": AutocompleteModelWidget(
|
"room": AutocompleteModelWidget(
|
||||||
|
|
Loading…
Reference in a new issue