Commit 090e76e1 authored by Georges Gressot's avatar Georges Gressot 💬
Browse files

on

parent add60c9c
......@@ -88,7 +88,8 @@
<td>{% trans "Troisième contact" %}</td>
<td>{% if l.0.contact_ter != None %} {{ l.0.contact_ter }} {% else %} ({% trans "Vacant" %}) {% endif %}</td>
<td>{% if l.3 != None %} {{ l.3.username }} {% endif %}</td>
<!-- <td><form method="post">{% csrf_token %}{{ formlibct3.contact3 }} <input type="submit" value="{% trans "Valider" %}"></form> {% if l.contact_ter != None %}<form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ formlibsu3.suppr3 }} <input type="submit" value="{% trans "Valider" %}"></form>{% else %}{% endif %}</td> </tr> -->
<!-- <td><form method="post">{% csrf_token %}{{ formlibct3.contact3 }} <input type="submit" value="{% trans "Valider" %}"></form> {% if l.contact_ter != None %}<form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ formlibsu3.suppr3 }} <input type="submit" value="{% trans "Valider" %}"></form>{% else %}{% endif %}</td> -->
</tr>
</tbody>
{% endfor %}
......@@ -135,10 +136,36 @@
<HR> -->
<p>{% trans "Gestion des administrateurs" %} ({{ sizeadm }}) :</p>
<table border="1">
<thead>
<th>{% trans "mail de l'admin" %}</th>
<th>{% trans "identifiant" %}</th>
<!-- <th>{% trans "Identifiant" %}</th> -->
<!-- <th>{% trans "Le cas échéant, nouvelle valeur" %}</th> -->
</thead>
<tbody>
{% for adm in admintuple %}
<tr>
<td>{{ adm.0 }}</td>
<td>{{ adm.1.username }}</td>
</tr>
</tbody>
{% endfor %}
</table>
<p><form method="post">{% csrf_token %}{% trans "Ajouter un administrateur pour ce projet" %} : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email {{ projadmform.contact }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {% trans "Identifiant" %} {{ projadmform.ident }} <input type="submit" value="{% trans "Valider" %}"></form></p>
<p><form method="post"> {% csrf_token %}{% trans "Modification d'un administrateur" %} : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {% trans "email actuel" %} {{ projmodadmform.curcontact }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% trans "email souhaité" %} {{ projmodadmform.newcontact }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% trans "Identifiant souhaité" %} : {{ projmodadmform.ident }} <input type="submit" value="{% trans "Valider" %}"> </form><p>
{% if sizeadm > 1 %}
<p><form method="post"> {% csrf_token %} {% trans "Suppression d'un administrateur" %} : {{ bddadmform.bddadmemail }} {% trans "êtes-vous sûr ?" %} <input type="submit" value="{% trans "Oui, je supprime" %}"> </form><p>
<p><form method="post"> {% csrf_token %}{% trans "Suppression d'un administrateur" %} : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {% trans "email" %} {{ projmodadmform.curcontact }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {% trans "êtes-vous sûr ?" %} {{ projmodadmform.suppr }} <input type="submit" value="{% trans "Supprimer" %}"> </form><p>
{% endif %}
<HR>
......
......@@ -308,22 +308,27 @@ def adminbase(request, bdd):
# librmform = LibrForm(request.POST or None, instance =j)
# if librmform.is_valid():
# a =1
# gift =a
ADMIN_CHOICES =('', _('Sélectionnez')),
admintuple =('', ''),
for b in BddAdmin.objects.using(bdd).all():
ADMIN_CHOICES +=(b.contact, b.contact),
sizeadm =len(ADMIN_CHOICES[1:])
class AdminForm(forms.Form):
bddadmemail = forms.ChoiceField(required =True, widget=forms.Select, choices = ADMIN_CHOICES, label =_("email admin"))
bddadmform =AdminForm(request.POST or None)
if bddadmform.is_valid():
seladmin =BddAdmin.objects.using(bdd).get(contact =bddadmform.cleaned_data['bddadmemail'])
seladmin.delete(using =bdd)#suppression impossible quand il n'y a plus qu'un seul bddadmin pour le projet (ce contrôle est réalisé dans le template)
return HttpResponseRedirect(url)
admintuple +=(b.contact, Utilisateur.objects.using(bdd).get(mail =BddAdmin.objects.using(bdd).get(contact =b.contact))),
admintuple =admintuple[1:]
sizeadm =len(BddAdmin.objects.using(bdd).all())
class ProjadmModForm(forms.Form):
curcontact = forms.EmailField(required =True, label ='current email')
newcontact = forms.EmailField(required =False, label ='new email')
ident = forms.CharField(required =False, widget=forms.TextInput(attrs=\
{'placeholder': "Basin@" + bdd, 'title': _("Suffixe obligatoire") + \
' : ' + '@' + bdd + '. ' + \
"Saisissez un nom d'utilisateur valide. Il ne peut contenir que des lettres, des nombres ou les caractères « @ », « . », « + », « - » et « _ »."}), \
max_length=30, label =_("identifiant"))
suppr = forms.BooleanField(required=True)
projmodadmform =ProjadmModForm(request.POST or None)
class ProjadmForm(forms.Form):
contact = forms.EmailField(required =True, label ='email')
contact = forms.EmailField(required =True, label ='current email')
ident = forms.CharField(required =True, widget=forms.TextInput(attrs=\
{'placeholder': "Rosemonde@" + bdd, 'title': _("Suffixe obligatoire") + \
' : ' + '@' + bdd + '. ' + \
......@@ -338,7 +343,7 @@ def adminbase(request, bdd):
if not projadmform.cleaned_data['contact'] in emaillist:
newadm =BddAdmin()
newadm.contact =projadmform.cleaned_data['contact']
newadm.nothere =False
newadm.ident =projadmform.cleaned_data['ident']
newadm.save(using =bdd)
return HttpResponseRedirect(url)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment