# -*- mode: python -*- # -*- coding: utf-8 -*- ############################################################################## # # Gestion scolarite IUT # # Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Emmanuel Viennet emmanuel.viennet@viennet.net # ############################################################################## """Formulaires gestion des groupes """ import flask from flask import flash, g, render_template, request, url_for from app.models import FormSemestre, GroupDescr, Partition from app.models import GROUPNAME_STR_LEN from app.scodoc.sco_exceptions import AccessDenied import app.scodoc.sco_utils as scu from app.scodoc.TrivialFormulator import TrivialFormulator def affect_groups(partition_id): """(ancien) formulaire affectation des etudiants aux groupes de la partition. Permet aussi la creation et la suppression de groupes. """ # réécrit pour 9.0.47 avec un template partition = Partition.get_or_404(partition_id) formsemestre = partition.formsemestre if not formsemestre.can_change_groups(): raise AccessDenied("vous n'avez pas la permission de modifier les groupes") formsemestre.setup_parcours_groups() return render_template( "scolar/affect_groups.j2", title="Affectation aux groupes", javascripts=["js/groupmgr.js"], cssstyles=["css/groups.css"], partition=partition, # Liste des partitions sans celle par defaut: partitions_list=partition.formsemestre.partitions.filter( Partition.partition_name != None ), formsemestre_id=formsemestre.id, ) def group_rename(group_id): """Form to rename a group""" group: GroupDescr = GroupDescr.get_or_404(group_id) formsemestre_id = group.partition.formsemestre_id formsemestre = FormSemestre.get_formsemestre(formsemestre_id) if not formsemestre.can_change_groups(): raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") H = [f"