mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-30 00:22:25 +00:00
Refactor l'affichage des réglages, factorisation et utilisation help_text
This commit is contained in:
parent
dcd1e2af96
commit
60b2a6cd9d
3 changed files with 170 additions and 163 deletions
|
@ -66,24 +66,35 @@ class OptionalUser(AclMixin, PreferencesModel):
|
||||||
activation ou non du solde, autorisation du negatif, fingerprint etc"""
|
activation ou non du solde, autorisation du negatif, fingerprint etc"""
|
||||||
PRETTY_NAME = "Options utilisateur"
|
PRETTY_NAME = "Options utilisateur"
|
||||||
|
|
||||||
is_tel_mandatory = models.BooleanField(default=True)
|
is_tel_mandatory = models.BooleanField(
|
||||||
user_solde = models.BooleanField(default=False)
|
default=True,
|
||||||
|
help_text="Obligation de renseigner le téléphone"
|
||||||
|
)
|
||||||
|
user_solde = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="Solde pour les users"
|
||||||
|
)
|
||||||
solde_negatif = models.DecimalField(
|
solde_negatif = models.DecimalField(
|
||||||
max_digits=5,
|
max_digits=5,
|
||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
default=0
|
default=0,
|
||||||
|
help_text="Maximum de négatif autorisé"
|
||||||
)
|
)
|
||||||
max_solde = models.DecimalField(
|
max_solde = models.DecimalField(
|
||||||
max_digits=5,
|
max_digits=5,
|
||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
default=50
|
default=50,
|
||||||
|
help_text="Valeur maximum du solde"
|
||||||
)
|
)
|
||||||
min_online_payment = models.DecimalField(
|
min_online_payment = models.DecimalField(
|
||||||
max_digits=5,
|
max_digits=5,
|
||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
default=10
|
default=10,
|
||||||
|
help_text="Montant minimum pour le rechargement online"
|
||||||
)
|
)
|
||||||
gpg_fingerprint = models.BooleanField(default=True)
|
gpg_fingerprint = models.BooleanField(
|
||||||
|
default=True,
|
||||||
|
help_text="Gpg fingerprint activée")
|
||||||
all_can_create_club = models.BooleanField(
|
all_can_create_club = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
help_text="Les users peuvent créer un club"
|
help_text="Les users peuvent créer un club"
|
||||||
|
@ -100,7 +111,8 @@ class OptionalUser(AclMixin, PreferencesModel):
|
||||||
'users.ListShell',
|
'users.ListShell',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
|
help_text="Shell par default"
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -138,13 +150,20 @@ class OptionalMachine(AclMixin, PreferencesModel):
|
||||||
(DISABLED, 'Désactivé'),
|
(DISABLED, 'Désactivé'),
|
||||||
)
|
)
|
||||||
|
|
||||||
password_machine = models.BooleanField(default=False)
|
password_machine = models.BooleanField(
|
||||||
max_lambdauser_interfaces = models.IntegerField(default=10)
|
default=False,
|
||||||
max_lambdauser_aliases = models.IntegerField(default=10)
|
help_text="Un mot de passe par machine activé")
|
||||||
|
max_lambdauser_interfaces = models.IntegerField(
|
||||||
|
default=10,
|
||||||
|
help_text="Maximum d'interface pour un user sans droits")
|
||||||
|
max_lambdauser_aliases = models.IntegerField(
|
||||||
|
default=10,
|
||||||
|
help_text="Maximum de cname pour un user sans droits")
|
||||||
ipv6_mode = models.CharField(
|
ipv6_mode = models.CharField(
|
||||||
max_length=32,
|
max_length=32,
|
||||||
choices=CHOICE_IPV6,
|
choices=CHOICE_IPV6,
|
||||||
default='DISABLED'
|
default='DISABLED',
|
||||||
|
help_text="Mode ipv6"
|
||||||
)
|
)
|
||||||
create_machine = models.BooleanField(
|
create_machine = models.BooleanField(
|
||||||
default=True,
|
default=True,
|
||||||
|
@ -187,21 +206,24 @@ class OptionalTopologie(AclMixin, PreferencesModel):
|
||||||
radius_general_policy = models.CharField(
|
radius_general_policy = models.CharField(
|
||||||
max_length=32,
|
max_length=32,
|
||||||
choices=CHOICE_RADIUS,
|
choices=CHOICE_RADIUS,
|
||||||
default='DEFINED'
|
default='DEFINED',
|
||||||
|
help_text="Politique par defaut de placement de vlan avec radius"
|
||||||
)
|
)
|
||||||
vlan_decision_ok = models.OneToOneField(
|
vlan_decision_ok = models.OneToOneField(
|
||||||
'machines.Vlan',
|
'machines.Vlan',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='decision_ok',
|
related_name='decision_ok',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
|
help_text="Placement sur ce vlan par default en cas d'accès OK"
|
||||||
)
|
)
|
||||||
vlan_decision_nok = models.OneToOneField(
|
vlan_decision_nok = models.OneToOneField(
|
||||||
'machines.Vlan',
|
'machines.Vlan',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
related_name='decision_nok',
|
related_name='decision_nok',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
|
help_text="Placement par defaut sur ce vlan en cas de rejet"
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -225,23 +247,44 @@ class GeneralOption(AclMixin, PreferencesModel):
|
||||||
general_message = models.TextField(
|
general_message = models.TextField(
|
||||||
default="",
|
default="",
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="Message général affiché sur le site (maintenance, etc"
|
help_text="Message général affiché sur le site (maintenance, etc)"
|
||||||
|
)
|
||||||
|
search_display_page = models.IntegerField(
|
||||||
|
default=15,
|
||||||
|
help_text="Nombre de résultats affichés dans une recherche"
|
||||||
|
)
|
||||||
|
pagination_number = models.IntegerField(
|
||||||
|
default=25,
|
||||||
|
help_text="Nombre d'item par page paginée"
|
||||||
|
)
|
||||||
|
pagination_large_number = models.IntegerField(
|
||||||
|
default=8,
|
||||||
|
help_text="Nombre d'item par page paginée, items larges"
|
||||||
|
)
|
||||||
|
req_expire_hrs = models.IntegerField(
|
||||||
|
default=48,
|
||||||
|
help_text="Delais d'expiration des token changement de mdp, en heure"
|
||||||
|
)
|
||||||
|
site_name = models.CharField(
|
||||||
|
max_length=32,
|
||||||
|
default="Re2o",
|
||||||
|
help_text="Nom du site web, par defaut re2o"
|
||||||
|
)
|
||||||
|
email_from = models.EmailField(
|
||||||
|
default="www-data@example.com",
|
||||||
|
help_text="From des mails envoyés par re2o"
|
||||||
)
|
)
|
||||||
search_display_page = models.IntegerField(default=15)
|
|
||||||
pagination_number = models.IntegerField(default=25)
|
|
||||||
pagination_large_number = models.IntegerField(default=8)
|
|
||||||
req_expire_hrs = models.IntegerField(default=48)
|
|
||||||
site_name = models.CharField(max_length=32, default="Re2o")
|
|
||||||
email_from = models.EmailField(default="www-data@example.com")
|
|
||||||
GTU_sum_up = models.TextField(
|
GTU_sum_up = models.TextField(
|
||||||
default="",
|
default="",
|
||||||
blank=True,
|
blank=True,
|
||||||
|
help_text="Résumé des CGU à l'inscription"
|
||||||
)
|
)
|
||||||
GTU = models.FileField(
|
GTU = models.FileField(
|
||||||
upload_to='',
|
upload_to='',
|
||||||
default="",
|
default="",
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
|
help_text="CGU et documents réglementaires à l'inscription"
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -280,19 +323,43 @@ class AssoOption(AclMixin, PreferencesModel):
|
||||||
|
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
default="Association réseau école machin",
|
default="Association réseau école machin",
|
||||||
max_length=256
|
max_length=256,
|
||||||
|
help_text="Nom complet de l'asso"
|
||||||
|
)
|
||||||
|
siret = models.CharField(
|
||||||
|
default="00000000000000",
|
||||||
|
max_length=32,
|
||||||
|
help_text="Numero SIRET"
|
||||||
|
)
|
||||||
|
adresse1 = models.CharField(
|
||||||
|
default="1 Rue de exemple",
|
||||||
|
max_length=128,
|
||||||
|
help_text="Adresse"
|
||||||
|
)
|
||||||
|
adresse2 = models.CharField(
|
||||||
|
default="94230 Cachan",
|
||||||
|
max_length=128
|
||||||
|
)
|
||||||
|
contact = models.EmailField(
|
||||||
|
default="contact@example.org",
|
||||||
|
help_text="Mail de contact"
|
||||||
|
)
|
||||||
|
telephone = models.CharField(
|
||||||
|
max_length=15,
|
||||||
|
default="0000000000",
|
||||||
|
help_text="Téléphone de contact"
|
||||||
|
)
|
||||||
|
pseudo = models.CharField(
|
||||||
|
default="Asso",
|
||||||
|
max_length=32,
|
||||||
|
help_text="Pseudo de l'asso"
|
||||||
)
|
)
|
||||||
siret = models.CharField(default="00000000000000", max_length=32)
|
|
||||||
adresse1 = models.CharField(default="1 Rue de exemple", max_length=128)
|
|
||||||
adresse2 = models.CharField(default="94230 Cachan", max_length=128)
|
|
||||||
contact = models.EmailField(default="contact@example.org")
|
|
||||||
telephone = models.CharField(max_length=15, default="0000000000")
|
|
||||||
pseudo = models.CharField(default="Asso", max_length=32)
|
|
||||||
utilisateur_asso = models.OneToOneField(
|
utilisateur_asso = models.OneToOneField(
|
||||||
'users.User',
|
'users.User',
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
|
help_text="Utilisateur dans la db correspondant à l'asso"
|
||||||
)
|
)
|
||||||
PAYMENT = (
|
PAYMENT = (
|
||||||
('NONE', 'NONE'),
|
('NONE', 'NONE'),
|
||||||
|
@ -302,20 +369,24 @@ class AssoOption(AclMixin, PreferencesModel):
|
||||||
max_length=255,
|
max_length=255,
|
||||||
choices=PAYMENT,
|
choices=PAYMENT,
|
||||||
default='NONE',
|
default='NONE',
|
||||||
|
help_text="Mode de paiement en ligne"
|
||||||
)
|
)
|
||||||
payment_id = models.CharField(
|
payment_id = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
default='',
|
default='',
|
||||||
blank=True
|
blank=True,
|
||||||
|
help_text="Id de paiement en ligne"
|
||||||
)
|
)
|
||||||
payment_pass = AESEncryptedField(
|
payment_pass = AESEncryptedField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
|
help_text="Clef de paiement en ligne"
|
||||||
)
|
)
|
||||||
description = models.TextField(
|
description = models.TextField(
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
|
help_text="Description de l'asso"
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -37,40 +37,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<p>
|
<p>
|
||||||
</p>
|
</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
{% for line in useroptions %}
|
||||||
<th>Téléphone obligatoirement requis</th>
|
|
||||||
<td>{{ useroptions.is_tel_mandatory }}</td>
|
|
||||||
<th>Activation du solde pour les utilisateurs</th>
|
|
||||||
<td>{{ useroptions.user_solde }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Champ gpg fingerprint</th>
|
|
||||||
<td>{{ useroptions.gpg_fingerprint }}</td>
|
|
||||||
{% if useroptions.user_solde %}
|
|
||||||
<th>Solde négatif</th>
|
|
||||||
<td>{{ useroptions.solde_negatif }}</td>
|
|
||||||
{% endif %}
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Creations d'adhérents par tous</th>
|
|
||||||
<td>{{ useroptions.all_can_create_adherent }}</td>
|
|
||||||
<th>Creations de clubs par tous</th>
|
|
||||||
<td>{{ useroptions.all_can_create_club }}</td>
|
|
||||||
</tr>
|
|
||||||
{% if useroptions.user_solde %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Solde maximum</th>
|
{% for text, field in line %}
|
||||||
<td>{{ useroptions.max_solde }}</td>
|
<th>{{ field }}</th>
|
||||||
<th>Montant minimal de rechargement en ligne</th>
|
<td>{{ text }}</td>
|
||||||
<td>{{ useroptions.min_online_payment }}</td>
|
{% endfor %}
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
<tr>
|
|
||||||
<th>Auto inscription</th>
|
|
||||||
<td>{{ useroptions.self_adhesion }}</td>
|
|
||||||
<th>Shell par défaut des utilisateurs</th>
|
|
||||||
<td>{{ useroptions.shell_default }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<h4>Préférences machines</h4>
|
<h4>Préférences machines</h4>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalMachine' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalMachine' %}">
|
||||||
|
@ -79,23 +53,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</a>
|
</a>
|
||||||
<p>
|
<p>
|
||||||
</p>
|
</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
{% for line in machineoptions %}
|
||||||
<th>Mot de passe par machine</th>
|
|
||||||
<td>{{ machineoptions.password_machine }}</td>
|
|
||||||
<th>Machines/interfaces autorisées par utilisateurs</th>
|
|
||||||
<td>{{ machineoptions.max_lambdauser_interfaces }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Alias dns autorisé par utilisateur</th>
|
|
||||||
<td>{{ machineoptions.max_lambdauser_aliases }}</td>
|
|
||||||
<th>Support de l'ipv6</th>
|
|
||||||
<td>{{ machineoptions.ipv6_mode }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Creation de machines</th>
|
{% for text, field in line %}
|
||||||
<td>{{ machineoptions.create_machine }}</td>
|
<th>{{ field }}</th>
|
||||||
|
<td>{{ text }}</td>
|
||||||
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<h4>Préférences topologie</h4>
|
<h4>Préférences topologie</h4>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalTopologie' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'OptionalTopologie' %}">
|
||||||
|
@ -105,19 +71,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<p>
|
<p>
|
||||||
</p>
|
</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
{% for line in topologieoptions %}
|
||||||
<th>Politique générale de placement de vlan</th>
|
<tr>
|
||||||
<td>{{ topologieoptions.radius_general_policy }}</td>
|
{% for text, field in line %}
|
||||||
<th> Ce réglage défini la politique vlan après acceptation radius : soit sur le vlan de la plage d'ip de la machine, soit sur un vlan prédéfini dans "Vlan où placer les machines après acceptation RADIUS"</th>
|
<th>{{ field }}</th>
|
||||||
<td></td>
|
<td>{{ text }}</td>
|
||||||
</tr>
|
{% endfor %}
|
||||||
<tr>
|
</tr>
|
||||||
<th>Vlan où placer les machines après acceptation RADIUS</th>
|
{% endfor %}
|
||||||
<td>{{ topologieoptions.vlan_decision_ok }}</td>
|
|
||||||
<th>Vlan où placer les machines après rejet RADIUS</th>
|
|
||||||
<td>{{ topologieoptions.vlan_decision_nok }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h4>Préférences generales</h4>
|
<h4>Préférences generales</h4>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'GeneralOption' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'GeneralOption' %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
|
@ -126,35 +89,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<p>
|
<p>
|
||||||
</p>
|
</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
{% for line in generaloptions %}
|
||||||
<th>Nom du site web</th>
|
|
||||||
<td>{{ generaloptions.site_name }}</td>
|
|
||||||
<th>Adresse mail d'expedition automatique</th>
|
|
||||||
<td>{{ generaloptions.email_from }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Affichage de résultats dans le champ de recherche</th>
|
|
||||||
<td>{{ generaloptions.search_display_page }}</td>
|
|
||||||
<th>Nombre d'items affichés en liste (taille normale)</th>
|
|
||||||
<td>{{ generaloptions.pagination_number }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Nombre d'items affichés en liste (taille élevée)</th>
|
|
||||||
<td>{{ generaloptions.pagination_large_number }}</td>
|
|
||||||
<th>Temps avant expiration du lien de reinitialisation de mot de passe (en heures)</th>
|
|
||||||
<td>{{ generaloptions.req_expire_hrs }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Message global affiché sur le site</th>
|
{% for text, field in line %}
|
||||||
<td>{{ generaloptions.general_message }}</td>
|
<th>{{ field }}</th>
|
||||||
<th>Résumé des CGU</th>
|
<td>{{ text }}</td>
|
||||||
<td>{{ generaloptions.GTU_sum_up }}</td>
|
{% endfor %}
|
||||||
<tr>
|
</tr>
|
||||||
<tr>
|
{% endfor %}
|
||||||
<th>CGU</th>
|
|
||||||
<td>{{generaloptions.GTU}}</th>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h4>Données de l'association</h4>
|
<h4>Données de l'association</h4>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'AssoOption' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'AssoOption' %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
|
@ -163,37 +107,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<p>
|
<p>
|
||||||
</p>
|
</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
{% for line in assooptions %}
|
||||||
<th>Nom</th>
|
<tr>
|
||||||
<td>{{ assooptions.name }}</td>
|
{% for text, field in line %}
|
||||||
<th>SIRET</th>
|
<th>{{ field }}</th>
|
||||||
<td>{{ assooptions.siret }}</td>
|
<td>{{ text }}</td>
|
||||||
</tr>
|
{% endfor %}
|
||||||
<tr>
|
</tr>
|
||||||
<th>Adresse</th>
|
{% endfor %}
|
||||||
<td>{{ assooptions.adresse1 }}<br>
|
|
||||||
{{ assooptions.adresse2 }}</td>
|
|
||||||
<th>Contact mail</th>
|
|
||||||
<td>{{ assooptions.contact }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Telephone</th>
|
|
||||||
<td>{{ assooptions.telephone }}</td>
|
|
||||||
<th>Pseudo d'usage</th>
|
|
||||||
<td>{{ assooptions.pseudo }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Objet utilisateur de l'association</th>
|
|
||||||
<td>{{ assooptions.utilisateur_asso }}</td>
|
|
||||||
<th>Moyen de paiement automatique</th>
|
|
||||||
<td>{{ assooptions.payment }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Description de l'association</th>
|
|
||||||
<td colspan="3">{{ assooptions.description | safe }}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h4>Messages personalisé dans les mails</h4>
|
<h4>Messages personalisé dans les mails</h4>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'MailMessageOption' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'MailMessageOption' %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
|
@ -202,20 +125,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<p>
|
<p>
|
||||||
</p>
|
</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
{% for line in assooptions %}
|
||||||
<th>Mail de bienvenue (Français)</th>
|
<tr>
|
||||||
<td>{{ mailmessageoptions.welcome_mail_fr | safe }}</td>
|
{% for text, field in line %}
|
||||||
|
<th>{{ field }}</th>
|
||||||
|
<td>{{ text }}</td>
|
||||||
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
{% endfor %}
|
||||||
<th>Mail de bienvenue (Anglais)</th>
|
|
||||||
<td>{{ mailmessageoptions.welcome_mail_en | safe }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>Liste des services et préférences page d'accueil</h2>
|
<h2>Liste des services et préférences page d'accueil</h2>
|
||||||
{% can_create preferences.Service%}
|
{% can_create preferences.Service%}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:add-service' %}"><i class="fa fa-plus"></i> Ajouter un service</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:add-service' %}"><i class="fa fa-plus"></i> Ajouter un service</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'preferences:del-services' %}"><i class="fa fa-trash"></i> Supprimer un ou plusieurs service</a>
|
|
||||||
{% include "preferences/aff_service.html" with service_list=service_list %}
|
{% include "preferences/aff_service.html" with service_list=service_list %}
|
||||||
|
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'HomeOption' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:edit-options' 'HomeOption' %}">
|
||||||
|
|
|
@ -51,12 +51,23 @@ from .models import (
|
||||||
MailMessageOption,
|
MailMessageOption,
|
||||||
GeneralOption,
|
GeneralOption,
|
||||||
OptionalTopologie,
|
OptionalTopologie,
|
||||||
HomeOption
|
HomeOption,
|
||||||
|
Reminder
|
||||||
)
|
)
|
||||||
from . import models
|
from . import models
|
||||||
from . import forms
|
from . import forms
|
||||||
|
|
||||||
|
|
||||||
|
def format_options(model):
|
||||||
|
"""Return a list of tuple for display of settings"""
|
||||||
|
model_formated = []
|
||||||
|
for field in model._meta.get_fields()[1::2]:
|
||||||
|
model_formated.append([(getattr(model, field.name), model._meta.get_field(field.name).help_text)])
|
||||||
|
for rank, field in enumerate(model._meta.get_fields()[2::2]):
|
||||||
|
model_formated[rank].append((getattr(model, field.name), model._meta.get_field(field.name).help_text))
|
||||||
|
return model_formated
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@can_view_all(OptionalUser)
|
@can_view_all(OptionalUser)
|
||||||
@can_view_all(OptionalMachine)
|
@can_view_all(OptionalMachine)
|
||||||
|
@ -76,15 +87,17 @@ def display_options(request):
|
||||||
homeoptions, _created = HomeOption.objects.get_or_create()
|
homeoptions, _created = HomeOption.objects.get_or_create()
|
||||||
mailmessageoptions, _created = MailMessageOption.objects.get_or_create()
|
mailmessageoptions, _created = MailMessageOption.objects.get_or_create()
|
||||||
service_list = Service.objects.all()
|
service_list = Service.objects.all()
|
||||||
|
reminder_list = Reminder.objects.all()
|
||||||
return form({
|
return form({
|
||||||
'useroptions': useroptions,
|
'useroptions': format_options(useroptions),
|
||||||
'machineoptions': machineoptions,
|
'machineoptions': format_options(machineoptions),
|
||||||
'topologieoptions': topologieoptions,
|
'topologieoptions': format_options(topologieoptions),
|
||||||
'generaloptions': generaloptions,
|
'generaloptions': format_options(generaloptions),
|
||||||
'assooptions': assooptions,
|
'assooptions': format_options(assooptions),
|
||||||
'homeoptions': homeoptions,
|
'homeoptions': format_options(homeoptions),
|
||||||
'mailmessageoptions': mailmessageoptions,
|
'mailmessageoptions': format_options(mailmessageoptions),
|
||||||
'service_list': service_list
|
'service_list': service_list,
|
||||||
|
'reminder_list':reminder_list
|
||||||
}, 'preferences/display_preferences.html', request)
|
}, 'preferences/display_preferences.html', request)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue