Commit 024e9907 authored by Georges Gressot's avatar Georges Gressot 💬
Browse files

rolling still ...

parent 11c11b59
......@@ -58,7 +58,7 @@ from django.utils.translation import ugettext_lazy as _
class BddAdminForm(forms.ModelForm):
class Meta:
model = BddAdmin
fields = ('contact', 'active',)
fields = ('contact',)
# widgets = {
# 'contact' : forms.EmailInput(),
# 'active' : forms.CheckBoxInput(),
......
......@@ -116,7 +116,6 @@ class Feature(models.Model):
class BddAdmin(models.Model):
"""Model for BDD administrator(s)"""
contact = models.EmailField('email')
active = models.BooleanField('active', default=True)
def __str__(self):
return self.contact
......
......@@ -77,12 +77,12 @@
</tr>
<tr>
<td>{% trans "Second contact" %}</td>
<td>{{ ctcti2 }}</td>
<td>{% if ctcti2 != None %} {{ ctcti2 }} {% else %} ({% trans "Vacante" %}) {% endif %}</td>
<td><form method="post">{% csrf_token %}{{ librmform.contact2 }} <input type="submit" value="{% trans "Valider" %}"></form> <form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ librmform.suppr2 }} <input type="submit" value="{% trans "Valider" %}"></form></td>
</tr>
<tr>
<td>{% trans "Troisième contact" %}</td>
<td>{{ ctcti3 }}</td>
<td>{% if ctcti3 != None %} {{ ctcti3 }} {% else %} ({% trans "Vacante" %}) {% endif %}</td>
<td><form method="post">{% csrf_token %}{{ librmform.contact3 }} <input type="submit" value="{% trans "Valider" %}"></form> <form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ librmform.suppr3 }} <input type="submit" value="{% trans "Valider" %}"></form></td>
</tr>
......@@ -95,35 +95,10 @@
<HR>
<p><b><center>{% trans "Attention : Le cas échéant, pensez à administrer les utilisateurs dans la base principale : à moins que .... !!! afficher ici les choses à régler !" %}. <a target="_blank" href="/./admin/">{% trans "OK j'y vais" %}</a></center></b></p>
<HR>
<table border="1">
<thead>
<th>{% trans "Administrateur du projet (email)" %}</th>
<th>{% trans "Le cas échéant, modifier l'email" %}</th>
<th>{% trans "Le cas échéant, cocher et valider pour supprimer cet administrateur" %}</th>
</thead>
<tbody>
{% for ad in admintupl %}
<tr>
<p>{% trans "Gestion des administrateurs" %} ({{ sizeadm }}) :</p>
<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>
<td>{{ ad.0 }}</td>
<td><form method="post"> {% csrf_token %} {{ ad.1.contact }} <input type="submit" value="{% trans "Valider" %}"> </form></td>
<td><center><form method="post"> {% csrf_token %} {{ ad.2.flag }} <input type="submit" value="{% trans "Valider" %}"> </form></center></td>
</tr>
{% endfor %}
</tbody>
</table>
<p><form method="post">{% csrf_token %}{% trans "Le cas échéant, ajouter un administrateur pour ce projet (email)" %} : {{ projadmform.contact }} <input type="submit" value="{% trans "Valider" %}"></form></p>
<p><form method="post">{% csrf_token %}{% trans "Ou ajouter un administrateur pour ce projet (email)" %} : {{ projadmform.contact }} <input type="submit" value="{% trans "Valider" %}"></form></p>
<HR>
<table border="1">
......
......@@ -204,7 +204,7 @@ def adminbase(request, bdd):
newexcl.save(using =bdd)
return HttpResponseRedirect(url)
LIBRARY_CHOICES = ('', 'Sélectionnez la bibliothèque'),
LIBRARY_CHOICES = ('', _('Sélectionnez la bibliothèque')), ('checker', 'checker'),
if Library.objects.using(bdd).all().exclude(name ='checker'):
for l in Library.objects.using(bdd).all().exclude(name ='checker').order_by('name'):
LIBRARY_CHOICES += (l.name, l.name),
......@@ -251,26 +251,21 @@ def adminbase(request, bdd):
# if librmform.is_valid():
# a =1
# gift =a
class ProjadmForm(forms.Form):
contact = forms.EmailField(required =True, label ='email')
# adminlist =BddAdmin.objects.using(bdd).all()
# admintupl =('', '', ''),
# for ad in adminlist:
# admintupl += (ad.contact, ProjadmForm(request.POST or None, contact =ad.contact), ProjadmSupprForm(request.POST or None, contact =ad.contact)),
# admintupl =admintupl[1:]
# for elmt in admintupl:
# if elmt[1].is_valid():
# modadm =BddAdmin.objects.using(bdd).get(contact =elmt[0])
# modadm.contact =elmt[1].cleaned_data['contact']
# modadm.save(using =bdd)
# return HttpResponseRedirect(url)
# if elmt[2].is_valid():
# modadm =BddAdmin.objects.using(bdd).get(contact =elmt[0])
# modadm.delete(using =bdd)
# return HttpResponseRedirect(url)
ADMIN_CHOICES =('', _('Sélectionnez')),
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)
return HttpResponseRedirect(url)
class ProjadmForm(forms.Form):
contact = forms.EmailField(required =True, label ='email')
projadmform =ProjadmForm(request.POST or None)
if projadmform.is_valid():
emaillist =[]
......@@ -280,6 +275,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.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