Commit e9722413 authored by Georges Gressot's avatar Georges Gressot 💬
Browse files

rolling ...

parent 024e9907
......@@ -51,7 +51,7 @@
<p><form method="post">{% csrf_token %}{% trans "Modification des propriétés d'une bibliothèque" %} : {{ libriform.librname }} <input type="submit" value="{% trans "Valider" %}"></form></p>
{% if g != 0 %}
{% if g != 0 %}
<table border="1">
......@@ -68,23 +68,22 @@
<tr>
<td>{% trans "Nom de la bibliothèque" %}</td>
<td>{{ libriname }}</td>
<td><form method="post">{% csrf_token %}{{ librmform.newlibrname }} <input type="submit" value="{% trans "Valider" %}"> {% trans "Rétroactif (instructions)" %}</form></td>
<td>{% if libriname != 'checker' %}<form method="post">{% csrf_token %}{{ formlibname.newlibrname }} <input type="submit" value="{% trans "Valider" %}"> {% trans "Rétroactif (instructions)" %}</form>{% else %} ({% trans "Non modifiable" %}) {% endif %}</td>
</tr>
<tr>
<td>{% trans "Contact principal" %}</td>
<td>{{ ctcti1 }}</td>
<td><form method="post">{% csrf_token %}{{ librmform.contact1 }} <input type="submit" value="{% trans "Valider" %}"></form></td>
<td><form method="post">{% csrf_token %}{{ formlibct1.contact1 }} <input type="submit" value="{% trans "Valider" %}"></form></td>
</tr>
<tr>
<td>{% trans "Second contact" %}</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>
<td><form method="post">{% csrf_token %}{{ formlibct2.contact2 }} <input type="submit" value="{% trans "Valider" %}"></form> {% if ctcti2 != None %}<form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ formlibsu2.suppr2 }} <input type="submit" value="{% trans "Valider" %}"></form>{% else %}{% endif %}</td>
</tr>
<tr>
<td>{% trans "Troisième contact" %}</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>
<td><form method="post">{% csrf_token %}{{ formlibct3.contact3 }} <input type="submit" value="{% trans "Valider" %}"></form> {% if ctcti3 != None %}<form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ formlibsu3.suppr3 }} <input type="submit" value="{% trans "Valider" %}"></form>{% else %}{% endif %}</td> </tr>
</tbody>
......@@ -93,8 +92,8 @@
{% endif %}
<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>
<!-- <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> -->
<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>
......
......@@ -211,25 +211,47 @@ def adminbase(request, bdd):
class LibrIForm(forms.Form):
librname = forms.ChoiceField(required =True, widget=forms.Select, choices = LIBRARY_CHOICES, label =_("nom de la bib"))
class LibrMForm(forms.Form):
class LibrMNameForm(forms.Form):
newlibrname = forms.CharField(required =True, widget=forms.TextInput(attrs={'size': '30'}), max_length=30, label =_("nom de la bib"))
class LibrMCtc1Form(forms.Form):
contact1 = forms.EmailField(required =True, label ='email 1')
class LibrMCtc2Form(forms.Form):
contact2 = forms.EmailField(required =True, label ='email 2')
class LibrMSu2Form(forms.Form):
suppr2 = forms.BooleanField(required=True)
class LibrMCtc3Form(forms.Form):
contact3 = forms.EmailField(required =True, label ='email 3')
class LibrMSu3Form(forms.Form):
suppr3 = forms.BooleanField(required=True)
libriform = LibrIForm(request.POST or None)
g =0
if libriform.is_valid():
g =1
libriname = libriform.cleaned_data['librname']
lib =Library.objects.using(bdd).get(name =libriname)
ctcti1 =Library.objects.using(bdd).get(name =libriname).contact
ctcti2 =Library.objects.using(bdd).get(name =libriname).contact_bis
ctcti3 =Library.objects.using(bdd).get(name =libriname).contact_ter
librmform = LibrMForm(request.POST or None)
formlibname = LibrMNameForm(request.POST or None)
formlibct1 = LibrMCtc1Form(request.POST or None)
formlibct2 = LibrMCtc2Form(request.POST or None)
formlibsu2 = LibrMSu2Form(request.POST or None)
formlibct3 = LibrMCtc3Form(request.POST or None)
formlibsu3 = LibrMSu3Form(request.POST or None)
if formlibname.is_valid():
if not libriname ==formlibname.cleaned_data['newlibrname'] and not formlibname.cleaned_data['newlibrname'] =='checker':
lib.name =formlibname.cleaned_data['newlibrname']
lib.save(using =bdd)
for insn in Instruction.objects.using(bdd).filter(name =formlibname.cleaned_data['newlibrname']):
insn.name =formlibname.cleaned_data['newlibrname']
insn.save(using =bdd)
for inso in Instruction.objects.using(bdd).filter(oname =formlibname.cleaned_data['newlibrname']):
inso.oname =formlibname.cleaned_data['newlibrname']
inso.save(using =bdd)
# pour supprimr contact2 ou contact3 !!!& Changement rétroactif sur l'ensemble des instructions (name et oname aussi)
# class SupAjForm(forms.Form):
# suppr = forms.BooleanField(required=False)
......@@ -241,7 +263,7 @@ def adminbase(request, bdd):
# sup = modeform.cleaned_data['suppr']
# aj = modeform.cleaned_data['ajo']
# recipient = form.cleaned_data['librname']
a=1
# a=1
# libname =i.name
# contact =i.contact
# contact_bis =i.contact_bis
......
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