diff --git a/colloscope/models.py b/colloscope/models.py index 334ca9e..108a534 100644 --- a/colloscope/models.py +++ b/colloscope/models.py @@ -13,11 +13,13 @@ calendrier = { ] } + class Lycee(models.Model): uai = models.CharField(max_length=10) libelle = models.CharField(max_length=100) vacances = models.CharField(max_length=1) + class Classe(models.Model): lycee = models.ForeignKey(Lycee, on_delete=models.CASCADE) libelle = models.CharField(max_length=20) diff --git a/colloscope/pdfexport.py b/colloscope/pdfexport.py index 340c8dc..9c780c8 100644 --- a/colloscope/pdfexport.py +++ b/colloscope/pdfexport.py @@ -3,83 +3,7 @@ from datetime import date, timedelta from colloscope.models import * from fpdf import FPDF -from fpdf.fonts import FontFace -from fpdf.enums import TableCellFillMode -""" -etudiants = [ - ['Aboujaib', 'Alexandre', 4, 'A', '', ''], - ['Ajan', 'George', 4, 'A', '', ''], - ['Akrad', 'Lina', 1, 'SI', '', ''], - ['Aubert', 'Nicolas', 1, 'SI', '', ''], - ['Badr', 'Roman', 4, 'A', '', ''], - ['Bazire', 'Aurélien', 5, 'A', '', ''], - ['Boit', 'Arthur', 5, 'A', '', ''], - ['Boubker', 'Youssef', 5, 'A', '', ''], - ['Boudjema', 'Dylan', 1, 'SI', '', ''], - ['Chiriac', 'Mihnea', 6, 'A', '', ''], - ['Courier', 'Marine', 6, 'A', '', ''], - ['Daguin', 'Joseph', 6, 'A', '', ''], - ['Dauguen', 'Gabriel', 7, 'A', '', ''], - ['De Weer', 'Matthias', 7, 'A', '', ''], - ['Desbouis', 'Katell', 2, 'SI', '', ''], - ['Dupouy', 'Jérémie', 7, 'A', '', ''], - ['Hariri--Gautier-Picard', 'Grégoire', 8, 'A', '', ''], - ['Juricevic', 'Matteo', 8, 'A', '', ''], - ['Knanoua', 'Anas', 8, 'A', '', ''], - ['Lesenne', 'Pierrick', 9, 'A', '', ''], - ['Lin', 'Hao', 2, 'SI', '', ''], - ['Masbatin', 'Lucas', 2, 'SI', '', ''], - ['Mayuran', 'Mithushan', 9, 'A', '', ''], - ['Messahli', 'Yassine', 9, 'A', '', ''], - ['Moguérou', 'Valentin', 10, 'B', '', ''], - ['Mohellebi', 'Mathéo', 10, 'B', '', ''], - ['Mouisset--Ferrara', 'Maël', 10, 'B', '', ''], - ['Ottavi', 'Corentin', 11, 'B', '', ''], - ['Ponce', 'Alexian', 11, 'B', '', ''], - ['Pujol', 'Raphaël', 11, 'B', '', ''], - ['Pustetto', 'Mathis', 12, 'B', '', ''], - ['Radice', 'Roman', 12, 'B', '', ''], - ['Rat', 'Evelyn', 12, 'B', '', ''], - ['Rousse', 'Louis', 3, 'SI', '', ''], - ['Roux', 'Gaëtan', 3, 'SI', '', ''], - ['Rouyre--Cros', 'Célian', 3, 'SI', '', ''], - ['Sourbé', 'François-Gabriel', 13, 'B', '', ''], - ['Stourbe', 'Simon', 13, 'B', '', ''], - ['Thai', 'Dany', 13, 'B', '', ''], - ['Théodore', 'Jonathan', 14, 'B', '', ''], - ['Vandroux', 'Benoît', 14, 'B', '', ''], - ['Veyssière', 'Thibaud', 14, 'B', '', ''], - ['Vié', 'Adrien', 15, 'B', '', ''], - ['Ye', 'Luan', 15, 'B', '', ''], - ['Zarka', 'Amélie', 15, 'B', '', ''], -] -""" - -creneaux = [ - ["Mathématiques", "vendredi", "17:00", "M. OUBAHA", "C382"], - ["Anglais", "mercredi", "14:00", "Mme LE GOURIELLEC", "C393"], - ["Mathématiques", "mercredi", "15:00", "M. BOULLY", "R004"], - ["Physique", "mardi", "14:00", "Mme CHEVALIER", "R103"], - ["Mathématiques", "mardi", "18:00", "M. RAPIN", "V152"], - ["Anglais", "mardi", "14:00", "Mme BELAGGOUNE", "C4??"], - ["pas de colle", "", "", "", ""], - ["Physique", "mardi", "17:00", "M. COLIN", "C386"], - ["Mathématiques", "mercredi", "13:30", "M. BOUVEROT", "??"], - ["Anglais", "lundi", "13:00", "M. HERBAUT", "V052"], -] - -semaines = list(range(24, 34)) - -rotations = [ - # [semaine, groupe, creneau] - (24, 1, 1), - (24, 2, 2), - (24, 3, 3), - (27, 3, 3), - (28, 3, 3), - (31, 3, 3), -] class PDF(FPDF): def liste_eleves(self, periode): diff --git a/colloscope/table.py b/colloscope/table.py new file mode 100644 index 0000000..07bba19 --- /dev/null +++ b/colloscope/table.py @@ -0,0 +1,59 @@ +from colloscope.models import * + +def table_colloscope(periode, heading=True, est_colle=True): + semaines = periode.range_semaines() + lundis = [ periode.classe.date_debut_sem(n) for n in semaines ] + creneaux = Creneau.objects.filter(periode=periode, est_colle=est_colle) + jours = ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"] + + s = "" + + s += "
{th} | \n" + + for sem in semaines: + s +=f"{sem} | \n" + + s += "||||||
---|---|---|---|---|---|---|---|
{lundi.strftime('%d/%m/%y')} | \n" + + s += "|||||||
{matiere.libelle} | \n" + s += f"{jours[jour]} | \n" + s += f"{heure.strftime('%H:%M')} | \n" + s += "{} {} | \n".format("M." if colleur.civilite=="M" else "Mme", colleur.nom.upper()) + s += f"salle | \n" + + for sem in semaines: + if Rotation.objects.filter(creneau=c, semaine=sem).exists(): + r = Rotation.objects.get(creneau=c, semaine=sem) + groupes = r.groupes + content = ", ".join(g.libelle for g in groupes.all()) + + if r.est_modifiee(): + s += f"{content} | \n" + else: + s += f"{content} | \n" + else: + s += "\n" + + s += " |
- Mathématiques : Dimension finie et matrices -
-- Physique : Mécanique du solide -
+{% block header %} ++ Lycée : {{ periode.classe.lycee.libelle }}. Classe : {{ periode.classe.libelle }}. +
- - - +Matière | +Jour | +Heure | +Colleur | +Salle | +|||
---|---|---|---|---|---|---|---|
{{ lundi | strftime:"%d/%m/%y" }} | + {% endfor %} +|||||||
{{ c.matiere.libelle }} | +{{ jours | getitem:c.jour }} | +{{ c.heure | strftime:"%H:%M" }} | ++ {% if c.colleur.civilite == "M" %} + M. + {% else %} + Mme + {% endif %} + + {{ c.colleur.nom | upper }} + | ++ {{ c.salle }} + | + + {% for sem, exists, r, est_modifiee, groupes in rs %} + {% if exists %} + {% if est_modifiee %} +{{ groupes | join:"," }} | + {% else %} +{{ groupes | join:"," }} | + {% endif %} + {% else %} ++ {% endif %} + {% endfor %} + |