Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Georges Gressot
eplouribounistra
Commits
1e6f4b53
Commit
1e6f4b53
authored
Jun 28, 2021
by
Georges Gressot
💬
Browse files
rollong
parent
4bb7bcbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
eplouribousse/apps/epl/templates/epl/adminbase.html
View file @
1e6f4b53
...
...
@@ -76,7 +76,7 @@
<!-- <td>{% if l.name != '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>
{% trans "Contact principal" %}
({% trans "Obligatoire" %})
</td>
<td>
{{ l.0.contact }}
</td>
<td>
{{ l.1.username }}
</td>
<!-- <td><form method="post">{% csrf_token %}{{ formlibct1.contact1 }} <input type="submit" value="{% trans "Valider" %}"></form></td> -->
...
...
@@ -105,32 +105,11 @@
{% trans "Nouveau nom de la bibliothèque" %} : {{ formnewlibname.newlibrname }}
<input
type=
"submit"
value=
"{% trans "
Valider
"
%}"
>
</form></p>
<p><form
method=
"post"
>
{% csrf_token %}
{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.curname }}
{% trans "email contact 1" %} : {{ formlibct1.contact1 }}
{% trans "Identifiant" %} : {{ formlibct1.ident }}
<input
type=
"submit"
value=
"{% trans "
Valider
"
%}"
>
</form></p>
<!-- -->
<p><form
method=
"post"
>
{% csrf_token %}{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.curname }}
{% trans "email contact 2" %} : {{ formlibct2.contact2 }}
{% trans "Identifiant" %} : {{ formlibct2.ident }}
<input
type=
"submit"
value=
"{% trans "
Valider
"
%}"
>
</form></p>
<!-- -->
<p><form
method=
"post"
>
{% csrf_token %}{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.curname }}
{% trans "email contact 3" %} : {{ formlibct3.contact3 }}
{% trans "Identifiant" %} : {{ formlibct3.ident }}
<input
type=
"submit"
value=
"{% trans "
Valider
"
%}"
>
</form>
<p><form
method=
"post"
>
{% csrf_token %}{% trans "Nom de la bibliothèque" %} : {{ formlibct.name }}
{{ formlibct.contactnbr }}
{% trans "email" %} : {{ formlibct.contact }}
{% trans "Identifiant" %} : {{ formlibct.ident }}
{% trans "Supprimer" %} : {{ formlibct.suppr }}
<input
type=
"submit"
value=
"{% trans "
Valider
"
%}"
>
</form>
</p>
<p><form
method=
"post"
>
{% csrf_token %}{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.curname }}
{% trans "Supprimer le contact 2" %} : {{ formlibsu2.suppr2 }}
<input
type=
"submit"
value=
"{% trans "
Valider
"
%}"
>
</form></p>
<!-- -->
<p><form
method=
"post"
>
{% csrf_token %}{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.curname }}
{% trans "Supprimer le contact 3" %} : {{ formlibsu3.suppr3 }}
<input
type=
"submit"
value=
"{% trans "
Valider
"
%}"
>
</form>
</p>
...
...
eplouribousse/apps/epl/views.py
View file @
1e6f4b53
...
...
@@ -232,35 +232,22 @@ def adminbase(request, bdd):
for
l
in
Library
.
objects
.
using
(
bdd
).
all
().
exclude
(
name
=
'checker'
).
order_by
(
'name'
):
LIBRARY_CHOICES
+=
(
l
.
name
,
l
.
name
),
CONTACT_CHOICE
=
(
''
,
_
(
'Contact'
)),
(
'1'
,
'1'
),
(
'2'
,
'2'
),
(
'3'
,
'3'
),
class
LibrMCurNameForm
(
forms
.
Form
):
curname
=
forms
.
CharField
(
required
=
True
,
widget
=
forms
.
TextInput
(
attrs
=
{
'size'
:
'30'
}),
max_length
=
30
,
label
=
_
(
"nom de la bib"
))
class
LibrMNewNameForm
(
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'
)
ident
=
forms
.
CharField
(
required
=
True
,
widget
=
forms
.
TextInput
(
attrs
=
\
class
LibrMCtcForm
(
forms
.
Form
):
name
=
forms
.
CharField
(
required
=
True
,
widget
=
forms
.
TextInput
(
attrs
=
{
'size'
:
'30'
}),
max_length
=
30
,
label
=
_
(
"nom de la bib"
))
contactnbr
=
forms
.
ChoiceField
(
required
=
True
,
widget
=
forms
.
Select
,
choices
=
CONTACT_CHOICE
)
contact
=
forms
.
EmailField
(
required
=
False
,
label
=
'email 1'
)
ident
=
forms
.
CharField
(
required
=
False
,
widget
=
forms
.
TextInput
(
attrs
=
\
{
'placeholder'
:
"Oriane@"
+
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"
))
class
LibrMCtc2Form
(
forms
.
Form
):
contact2
=
forms
.
EmailField
(
required
=
True
,
label
=
'email 2'
)
ident
=
forms
.
CharField
(
required
=
True
,
widget
=
forms
.
TextInput
(
attrs
=
\
{
'placeholder'
:
"Marcel@"
+
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"
))
class
LibrMSu2Form
(
forms
.
Form
):
suppr2
=
forms
.
BooleanField
(
required
=
True
)
class
LibrMCtc3Form
(
forms
.
Form
):
contact3
=
forms
.
EmailField
(
required
=
True
,
label
=
'email 3'
)
ident
=
forms
.
CharField
(
required
=
True
,
widget
=
forms
.
TextInput
(
attrs
=
\
{
'placeholder'
:
"Gisèle@"
+
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"
))
class
LibrMSu3Form
(
forms
.
Form
):
suppr3
=
forms
.
BooleanField
(
required
=
True
)
max_length
=
30
,
label
=
_
(
"identifiant 1"
))
suppr
=
forms
.
BooleanField
(
required
=
False
)
liblist
=
Library
.
objects
.
using
(
bdd
).
exclude
(
name
=
'checker'
)
sizelib
=
len
(
liblist
)
...
...
@@ -287,11 +274,8 @@ def adminbase(request, bdd):
formlibname
=
LibrMCurNameForm
(
request
.
POST
or
None
)
formnewlibname
=
LibrMNewNameForm
(
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
)
formlibct
=
LibrMCtcForm
(
request
.
POST
or
None
)
if
formlibname
.
is_valid
()
and
formnewlibname
.
is_valid
():
if
not
formlibname
.
cleaned_data
[
'curname'
]
==
formnewlibname
.
cleaned_data
[
'newlibrname'
]:
if
formlibname
.
cleaned_data
[
'curname'
]
==
'checker'
or
formnewlibname
.
cleaned_data
[
'newlibrname'
]
==
'checker'
:
...
...
@@ -310,6 +294,62 @@ def adminbase(request, bdd):
lib
.
save
(
using
=
bdd
)
return
HttpResponseRedirect
(
url
)
# sender =request.user.email
sender
=
"gressot@unistra.fr"
BDD_CHOICES
=
(
''
,
''
),
for
i
in
[
n
for
n
in
range
(
10
)]:
if
os
.
path
.
isfile
(
'{:02d}.db'
.
format
(
i
)):
p
=
Project
.
objects
.
using
(
'{:02d}'
.
format
(
i
)).
all
().
order_by
(
'pk'
)[
0
].
name
BDD_CHOICES
+=
(
'{:02d}'
.
format
(
i
),
p
),
BDD_CHOICES
=
BDD_CHOICES
[
1
:]
compteur
=
0
if
formlibct
.
is_valid
():
if
Library
.
objects
.
using
(
bdd
).
get
(
name
=
formlibct
.
cleaned_data
[
'name'
])
in
Library
.
objects
.
using
(
bdd
).
all
():
lib
=
Library
.
objects
.
using
(
bdd
).
get
(
name
=
formlibct
.
cleaned_data
[
'name'
])
if
formlibct
.
cleaned_data
[
'suppr'
]
==
True
:
if
formlibct
.
cleaned_data
[
'contactnbr'
]
==
'2'
:
for
datab
in
BDD_CHOICES
:
for
lb
in
Library
.
objects
.
using
(
datab
[
0
]).
all
():
if
lb
.
contact
==
lib
.
contact_bis
:
compteur
+=
1
if
lb
.
contact_bis
==
lib
.
contact_bis
:
compteur
+=
1
if
lb
.
contact_ter
==
lib
.
contact_bis
:
compteur
+=
1
for
bd
in
BddAdmin
.
objects
.
using
(
datab
[
0
]).
all
():
if
bd
.
contact
==
lib
.
contact_bis
:
compteur
+=
1
# if compteur >1 and not User.objects.get(email =lib.contact_bis).is_staff() and not User.objects.get(email =lib.contact_bis).is_superuser():
# lib.contact_bis =None
# lib.save(using =bdd)
# else:
# lib.contact_bis =None
# lib.save(using =bdd)
# usager =User.objects.get(email =lib.contact_bis)
# usager.delete()
# librnbr +=len(Library.objects.using(bdd[0]).all())
# itemrecnbr +=len(ItemRecord.objects.using(bdd[0]).all())
# instrnbr +=len(Instruction.objects.using(bdd[0]).all())
# cand =[]
# for e in ItemRecord.objects.using(bdd[0]).all():
# if len(ItemRecord.objects.using(bdd[0]).filter(sid =e.sid)) >1 and not e.sid in cand:
# cand.append(e.sid)
# totcand +=len(cand)
# libr.contact_bis =None
# libr.save(using =bdd)
# if formlibct.cleaned_data['contact'] and not formlibct.cleaned_data['ident']:
# recipient =[formlibct.cleaned_data['contact'], Library.objects.using(bdd).get(name =formlibct.cleaned_data['name']).contact]
# objet ="eplouribousse / " + project + " / " + _("Modification d'un contact (email)")
# message =_("Nouvel email de contact : ") + formlibct.cleaned_data['contact']
# # if contactnbr ==
# elif formlibct.cleaned_data['ident'] and not formlibct.cleaned_data['contact']:
# m =2
# elif formlibct.cleaned_data['ident'] and formlibct.cleaned_data['contact1']:
# recipient.append(formlibct1.cleaned_data['contact1'])
# m =3
# pour supprimr contact2 ou contact3 !!!
# class SupAjForm(forms.Form):
# suppr = forms.BooleanField(required=False)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment