2024-08-11 21:39:43 +02:00
|
|
|
##############################################################################
|
|
|
|
# ScoDoc
|
|
|
|
# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved.
|
|
|
|
# See LICENSE
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""Formulaire édition description formsemestre
|
|
|
|
"""
|
2024-08-13 16:47:55 +02:00
|
|
|
from wtforms import (
|
|
|
|
BooleanField,
|
|
|
|
FileField,
|
|
|
|
SelectField,
|
|
|
|
StringField,
|
|
|
|
TextAreaField,
|
|
|
|
SubmitField,
|
|
|
|
)
|
|
|
|
from wtforms.validators import AnyOf, Optional
|
2024-08-11 21:39:43 +02:00
|
|
|
|
2024-08-13 16:47:55 +02:00
|
|
|
from app.forms import ScoDocForm
|
|
|
|
from app.models import FORMSEMESTRE_DISPOSITIFS
|
|
|
|
from app.scodoc import sco_utils as scu
|
2024-08-11 21:39:43 +02:00
|
|
|
|
|
|
|
|
2024-08-13 16:47:55 +02:00
|
|
|
class DateDMYField(StringField):
|
|
|
|
"Champ date JJ/MM/AAAA"
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
render_kw = kwargs.pop("render_kw", {})
|
|
|
|
render_kw.update({"class": "datepicker", "size": 10})
|
|
|
|
super().__init__(*args, render_kw=render_kw, **kwargs)
|
|
|
|
|
|
|
|
# note: process_formdata(self, valuelist) ne fonctionne pas
|
|
|
|
# en cas d'erreur de saisie les valeurs ne sont pas ré-affichées.
|
|
|
|
# On vérifie donc les valeurs dans le code de la vue.
|
|
|
|
|
|
|
|
def process_data(self, value):
|
|
|
|
"Process data from model to form"
|
|
|
|
if value:
|
|
|
|
self.data = value.strftime(scu.DATE_FMT)
|
|
|
|
else:
|
|
|
|
self.data = ""
|
|
|
|
|
|
|
|
|
|
|
|
class FormSemestreDescriptionForm(ScoDocForm):
|
2024-08-11 21:39:43 +02:00
|
|
|
"Formulaire édition description formsemestre"
|
|
|
|
description = TextAreaField(
|
|
|
|
"Description",
|
|
|
|
validators=[Optional()],
|
|
|
|
description="""texte libre : informations
|
|
|
|
sur le contenu, les objectifs, les modalités d'évaluation, etc.""",
|
|
|
|
)
|
|
|
|
horaire = StringField(
|
|
|
|
"Horaire", validators=[Optional()], description="ex: les lundis 9h-12h"
|
|
|
|
)
|
2024-08-13 16:47:55 +02:00
|
|
|
date_debut_inscriptions = DateDMYField(
|
|
|
|
"Date de début des inscriptions",
|
|
|
|
description="""date d'ouverture des inscriptions
|
|
|
|
(laisser vide pour autoriser tout le temps)""",
|
|
|
|
render_kw={
|
|
|
|
"id": "date_debut_inscriptions",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
date_fin_inscriptions = DateDMYField(
|
|
|
|
"Date de fin des inscriptions",
|
|
|
|
render_kw={
|
|
|
|
"id": "date_fin_inscriptions",
|
|
|
|
},
|
|
|
|
)
|
2024-08-11 21:39:43 +02:00
|
|
|
image = FileField(
|
|
|
|
"Image", validators=[Optional()], description="Image illustrant cette formation"
|
|
|
|
)
|
2024-08-13 16:47:55 +02:00
|
|
|
campus = StringField(
|
|
|
|
"Campus", validators=[Optional()], description="ex: Villetaneuse"
|
|
|
|
)
|
|
|
|
salle = StringField("Salle", validators=[Optional()], description="ex: salle 123")
|
|
|
|
dispositif = SelectField(
|
|
|
|
"Dispositif",
|
|
|
|
choices=FORMSEMESTRE_DISPOSITIFS.items(),
|
|
|
|
coerce=int,
|
|
|
|
description="modalité de formation",
|
|
|
|
validators=[AnyOf(FORMSEMESTRE_DISPOSITIFS.keys())],
|
|
|
|
)
|
|
|
|
modalites_mcc = TextAreaField(
|
|
|
|
"Modalités de contrôle des connaissances",
|
|
|
|
validators=[Optional()],
|
|
|
|
description="texte libre",
|
|
|
|
)
|
|
|
|
photo_ens = FileField(
|
|
|
|
"Photo de l'enseignant(e)",
|
|
|
|
validators=[Optional()],
|
|
|
|
description="ou autre illustration",
|
|
|
|
)
|
|
|
|
public = StringField(
|
|
|
|
"Public visé", validators=[Optional()], description="ex: débutants"
|
|
|
|
)
|
|
|
|
prerequis = TextAreaField(
|
|
|
|
"Prérequis", validators=[Optional()], description="texte libre"
|
|
|
|
)
|
2024-08-11 21:39:43 +02:00
|
|
|
responsable = StringField(
|
2024-08-13 16:47:55 +02:00
|
|
|
"Responsable",
|
|
|
|
validators=[Optional()],
|
|
|
|
description="""nom de l'enseignant de la formation, ou personne
|
|
|
|
chargée de l'organisation du semestre.""",
|
|
|
|
)
|
|
|
|
|
|
|
|
wip = BooleanField(
|
|
|
|
"Travaux en cours",
|
|
|
|
description="work in progress: si coché, affichera juste le titre du semestre",
|
2024-08-11 21:39:43 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
submit = SubmitField("Enregistrer")
|
|
|
|
cancel = SubmitField("Annuler", render_kw={"formnovalidate": True})
|