forked from ScoDoc/ScoDoc
Fix: dialogue choix modules avec ids
This commit is contained in:
parent
cae4686fc4
commit
6bf4fe3762
@ -159,7 +159,7 @@ class User(UserMixin, db.Model):
|
|||||||
"""
|
"""
|
||||||
for field in ["nom", "prenom", "dept", "active", "email", "date_expiration"]:
|
for field in ["nom", "prenom", "dept", "active", "email", "date_expiration"]:
|
||||||
if field in data:
|
if field in data:
|
||||||
setattr(self, field, data[field])
|
setattr(self, field, data[field] or None)
|
||||||
if new_user:
|
if new_user:
|
||||||
if "user_name" in data:
|
if "user_name" in data:
|
||||||
# never change name of existing users
|
# never change name of existing users
|
||||||
|
@ -562,18 +562,11 @@ class TF(object):
|
|||||||
'<input type="text" name="%s" id="%s" size="%d" %s'
|
'<input type="text" name="%s" id="%s" size="%d" %s'
|
||||||
% (field, field, size, attribs)
|
% (field, field, size, attribs)
|
||||||
)
|
)
|
||||||
lem.append(('value="%(' + field + ')s" />') % values)
|
lem.append('value="%(' + field + ')s" />' % values)
|
||||||
suggest_js.append(
|
suggest_js.append(
|
||||||
"""var %s_opts = %s;
|
f"""var {field}_opts = {dict2js(descr.get("text_suggest_options", {}))};
|
||||||
var %s_as = new bsn.AutoSuggest('%s', %s_opts);
|
var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
|
||||||
"""
|
"""
|
||||||
% (
|
|
||||||
field,
|
|
||||||
dict2js(descr.get("text_suggest_options", {})),
|
|
||||||
field,
|
|
||||||
field,
|
|
||||||
field,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise ValueError("unkown input_type for form (%s)!" % input_type)
|
raise ValueError("unkown input_type for form (%s)!" % input_type)
|
||||||
|
@ -200,7 +200,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
|||||||
NB_SEM = parcours.NB_SEM
|
NB_SEM = parcours.NB_SEM
|
||||||
else:
|
else:
|
||||||
NB_SEM = 10 # fallback, max 10 semestres
|
NB_SEM = 10 # fallback, max 10 semestres
|
||||||
semestre_id_list = [-1] + [str(x) for x in range(1, NB_SEM + 1)]
|
semestre_id_list = ["-1"] + [str(x) for x in range(1, NB_SEM + 1)]
|
||||||
semestre_id_labels = []
|
semestre_id_labels = []
|
||||||
for sid in semestre_id_list:
|
for sid in semestre_id_list:
|
||||||
if sid == "-1":
|
if sid == "-1":
|
||||||
@ -578,7 +578,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
|||||||
itemtemplate = """<tr><td class="tf-fieldlabel">%(label)s</td><td class="tf-field">%(elem)s</td></tr>"""
|
itemtemplate = """<tr><td class="tf-fieldlabel">%(label)s</td><td class="tf-field">%(elem)s</td></tr>"""
|
||||||
modform.append(
|
modform.append(
|
||||||
(
|
(
|
||||||
str(mod["module_id"]),
|
"MI" + str(mod["module_id"]),
|
||||||
{
|
{
|
||||||
"input_type": "text_suggest",
|
"input_type": "text_suggest",
|
||||||
"size": 50,
|
"size": 50,
|
||||||
@ -738,8 +738,9 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
|||||||
formsemestre_id = sco_formsemestre.do_formsemestre_create(tf[2])
|
formsemestre_id = sco_formsemestre.do_formsemestre_create(tf[2])
|
||||||
# creation des modules
|
# creation des modules
|
||||||
for module_id in tf[2]["tf-checked"]:
|
for module_id in tf[2]["tf-checked"]:
|
||||||
|
assert module_id[:2] == "MI"
|
||||||
modargs = {
|
modargs = {
|
||||||
"module_id": module_id,
|
"module_id": int(module_id[2:]),
|
||||||
"formsemestre_id": formsemestre_id,
|
"formsemestre_id": formsemestre_id,
|
||||||
"responsable_id": tf[2][module_id],
|
"responsable_id": tf[2][module_id],
|
||||||
}
|
}
|
||||||
@ -755,7 +756,8 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
|||||||
# Note: la destruction echouera s'il y a des objets dependants
|
# Note: la destruction echouera s'il y a des objets dependants
|
||||||
# (eg des evaluations définies)
|
# (eg des evaluations définies)
|
||||||
# nouveaux modules
|
# nouveaux modules
|
||||||
checkedmods = tf[2]["tf-checked"]
|
# (retire le "MI" du début du nom de champs)
|
||||||
|
checkedmods = [int(x[2:]) for x in tf[2]["tf-checked"]]
|
||||||
sco_formsemestre.do_formsemestre_edit(context, tf[2])
|
sco_formsemestre.do_formsemestre_edit(context, tf[2])
|
||||||
ams = sco_moduleimpl.do_moduleimpl_list(
|
ams = sco_moduleimpl.do_moduleimpl_list(
|
||||||
context, formsemestre_id=formsemestre_id
|
context, formsemestre_id=formsemestre_id
|
||||||
|
@ -150,7 +150,9 @@ def create_user_form(context, REQUEST, user_name=None, edit=0):
|
|||||||
else:
|
else:
|
||||||
initvalues["roles"] = []
|
initvalues["roles"] = []
|
||||||
if "date_expiration" in initvalues:
|
if "date_expiration" in initvalues:
|
||||||
initvalues["date_expiration"] = u.date_expiration.strftime("%d/%m/%Y")
|
initvalues["date_expiration"] = (
|
||||||
|
u.date_expiration.strftime("%d/%m/%Y") if u.date_expiration else ""
|
||||||
|
)
|
||||||
initvalues["status"] = "" if u.active else "old"
|
initvalues["status"] = "" if u.active else "old"
|
||||||
orig_roles = { # set des roles existants avant édition
|
orig_roles = { # set des roles existants avant édition
|
||||||
UserRole.role_dept_from_string(role_dept)
|
UserRole.role_dept_from_string(role_dept)
|
||||||
|
Loading…
Reference in New Issue
Block a user