forked from ScoDoc/ScoDoc
affichage nom complet du dept. sur la page accueil
This commit is contained in:
parent
ff948cb98d
commit
6157e54a5f
@ -54,6 +54,7 @@ class CreateDeptForm(FlaskForm):
|
||||
validators.DataRequired("acronyme du département requis"),
|
||||
],
|
||||
)
|
||||
# description = StringField(label="Description")
|
||||
visible = BooleanField(
|
||||
"Visible sur page d'accueil",
|
||||
default=True,
|
||||
|
@ -12,8 +12,10 @@ class Departement(db.Model):
|
||||
"""Un département ScoDoc"""
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
acronym = db.Column(db.String(SHORT_STR_LEN), nullable=False, index=True)
|
||||
description = db.Column(db.Text())
|
||||
acronym = db.Column(
|
||||
db.String(SHORT_STR_LEN), nullable=False, index=True
|
||||
) # ne change jamais, voir la pref. DeptName
|
||||
description = db.Column(db.Text()) # pas utilisé par ScoDoc : voir DeptFullName
|
||||
date_creation = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
||||
visible = db.Column(
|
||||
db.Boolean(), nullable=False, default=True, server_default="true"
|
||||
|
@ -16,7 +16,9 @@
|
||||
<li>
|
||||
<a class="stdlink {{'link_accessible' if current_user.has_permission(Permission.ScoView, dept=dept.acronym) else 'link_unauthorized'}}"
|
||||
href="{{url_for('scolar.index_html', scodoc_dept=dept.acronym)}}">Département
|
||||
{{dept.preferences.filter_by(name="DeptName").first().value}}</a>
|
||||
{{dept.preferences.filter_by(name="DeptName").first().value}}
|
||||
{{ dept.preferences.filter_by( name="DeptFullName" ).first().value or "" }}
|
||||
</a>
|
||||
{% if current_user.is_administrator() %}
|
||||
<span class="dept_visibility">
|
||||
{% if dept.visible %}visible{% else %}caché aux utilisateurs{% endif %}
|
||||
|
@ -107,7 +107,11 @@ def create_dept():
|
||||
if request.method == "POST" and form.cancel.data: # cancel button
|
||||
return redirect(url_for("scodoc.index"))
|
||||
if form.validate_on_submit():
|
||||
departements.create_dept(form.acronym.data, visible=form.visible.data)
|
||||
departements.create_dept(
|
||||
form.acronym.data,
|
||||
visible=form.visible.data,
|
||||
# description=form.description.data,
|
||||
)
|
||||
flash(f"Département {form.acronym.data} créé.")
|
||||
return redirect(url_for("scodoc.index"))
|
||||
return render_template(
|
||||
|
Loading…
Reference in New Issue
Block a user