Fix: edition enseignants de modules
This commit is contained in:
parent
1b6fd99e94
commit
6a66bbaf62
@ -32,6 +32,7 @@ import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
|
||||
from flask import g, url_for
|
||||
from flask_login import current_user
|
||||
from app.auth.models import User
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
@ -178,17 +179,16 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None, REQUEST=None):
|
||||
caneditnotes = sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
|
||||
arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags()
|
||||
#
|
||||
module_resp = User.query.get(M["responsable_id"])
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Module %(titre)s" % Mod),
|
||||
"""<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod,
|
||||
# XXX """caneditevals=%s caneditnotes=%s""" % (caneditevals,caneditnotes),
|
||||
"""<div class="moduleimpl_tableaubord">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="fichetitre2">Responsable: </td><td class="redboldtext">""",
|
||||
sco_users.user_info(M["responsable_id"])["nomprenom"],
|
||||
"""<span class="blacktt">(%(responsable_id)s)</span>""" % M,
|
||||
<table>
|
||||
<tr>
|
||||
<td class="fichetitre2">Responsable: </td><td class="redboldtext">""",
|
||||
module_resp.get_nomcomplet(), # sco_users.user_info(M["responsable_id"])["nomprenom"],
|
||||
f"""<span class="blacktt">({module_resp.user_name})</span>""",
|
||||
]
|
||||
try:
|
||||
sco_moduleimpl.can_change_module_resp(REQUEST, moduleimpl_id)
|
||||
|
@ -553,7 +553,7 @@ def SignaleAbsenceGrSemestre(
|
||||
nwl = 0
|
||||
url_link_semaines = base_url_noweeks + "&nbweeks=%s" % nwl
|
||||
if moduleimpl_id:
|
||||
url_link_semaines += "&moduleimpl_id=" + moduleimpl_id
|
||||
url_link_semaines += "&moduleimpl_id=" + str(moduleimpl_id)
|
||||
#
|
||||
dates = [x.ISO() for x in dates]
|
||||
dayname = sco_abs.day_names()[jourdebut.weekday]
|
||||
|
@ -686,14 +686,14 @@ def edit_enseignants_form(REQUEST, moduleimpl_id):
|
||||
|
||||
# Liste des enseignants avec forme pour affichage / saisie avec suggestion
|
||||
userlist = sco_users.get_user_list()
|
||||
login2display = {} # user_name : forme pour affichage = "NOM Prenom (login)"
|
||||
uid2display = {} # uid : forme pour affichage = "NOM Prenom (login)"(login)"
|
||||
for u in userlist:
|
||||
login2display[u.user_name] = u.get_nomplogin()
|
||||
allowed_user_names = list(login2display.values())
|
||||
uid2display[u.id] = u.get_nomplogin()
|
||||
allowed_user_names = list(uid2display.values())
|
||||
|
||||
H = [
|
||||
"<ul><li><b>%s</b> (responsable)</li>"
|
||||
% login2display.get(M["responsable_id"], M["responsable_id"])
|
||||
% uid2display.get(M["responsable_id"], M["responsable_id"])
|
||||
]
|
||||
for ens in M["ens"]:
|
||||
u = User.query.get(ens["ens_id"])
|
||||
@ -808,13 +808,13 @@ def edit_moduleimpl_resp(REQUEST, moduleimpl_id):
|
||||
help_str = """<p class="help">Taper le début du nom de l'enseignant.</p>"""
|
||||
# Liste des enseignants avec forme pour affichage / saisie avec suggestion
|
||||
userlist = [sco_users.user_info(user=u) for u in sco_users.get_user_list()]
|
||||
login2display = {} # user_name : forme pour affichage = "NOM Prenom (login)"
|
||||
uid2display = {} # uid : forme pour affichage = "NOM Prenom (login)"
|
||||
for u in userlist:
|
||||
login2display[u["user_name"]] = u["nomplogin"]
|
||||
allowed_user_names = list(login2display.values())
|
||||
uid2display[u["id"]] = u["nomplogin"]
|
||||
allowed_user_names = list(uid2display.values())
|
||||
|
||||
initvalues = M
|
||||
initvalues["responsable_id"] = login2display.get(
|
||||
initvalues["responsable_id"] = uid2display.get(
|
||||
M["responsable_id"], M["responsable_id"]
|
||||
)
|
||||
form = [
|
||||
@ -880,7 +880,7 @@ def edit_moduleimpl_resp(REQUEST, moduleimpl_id):
|
||||
"notes.moduleimpl_status",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
head_message="responsable%20modifié",
|
||||
head_message="responsable modifié",
|
||||
)
|
||||
)
|
||||
|
||||
@ -1249,7 +1249,7 @@ def edit_enseignants_form_delete(REQUEST, moduleimpl_id, ens_id: int):
|
||||
WHERE moduleimpl_id = %(moduleimpl_id)s
|
||||
AND ens_id = %(ens_id)s
|
||||
""",
|
||||
{"module_impl_id": moduleimpl_id, "ens_id": ens_id},
|
||||
{"moduleimpl_id": moduleimpl_id, "ens_id": ens_id},
|
||||
)
|
||||
return flask.redirect("edit_enseignants_form?moduleimpl_id=%s" % moduleimpl_id)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user