From 49e56d97e5a126f66d1d52b5de45befe603893b2 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Thu, 7 Sep 2017 23:31:54 +0200 Subject: Remplacement de la licence GPL 2 par la licence AGPL 3 --- templatetags/rooms.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'templatetags/rooms.py') diff --git a/templatetags/rooms.py b/templatetags/rooms.py index d76f0ee..86515a4 100644 --- a/templatetags/rooms.py +++ b/templatetags/rooms.py @@ -1,18 +1,17 @@ # Copyright (C) 2017 Alban Gruin # -# celcatsanitizer 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 +# celcatsanitizer is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # celcatsanitizer 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. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License along -# with celcatsanitizer; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# You should have received a copy of the GNU Affero General Public License +# along with celcatsanitizer. If not, see . from django import template -- cgit v1.2.1 From b769b34de15ab37d7d97078a72045eb49d46036b Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Fri, 8 Sep 2017 12:32:30 +0200 Subject: Le tag format_rooms rassemble les amphis et les salles ensemble --- templatetags/rooms.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'templatetags/rooms.py') diff --git a/templatetags/rooms.py b/templatetags/rooms.py index 86515a4..5108c92 100644 --- a/templatetags/rooms.py +++ b/templatetags/rooms.py @@ -19,8 +19,22 @@ register = template.Library() @register.filter def format_rooms(rooms): - joined = ", ".join([str(room) for room in rooms]) - if len(rooms) > 1: - return "Salles {0}".format(joined) + amphi_list = [room.name for room in rooms if room.name.startswith("Amphi")] + room_list = [room.name for room in rooms if not room.name.startswith("Amphi")] + + amphis = ", ".join(amphi_list) + joined = ", ".join(room_list) + + if len(room_list) > 1: + joined = "alles " + joined + elif len(room_list) == 1: + joined = "alle " + joined + + if len(amphi_list) == 0 and len(room_list) == 0: + return "" + elif len(amphi_list) == 0: + return "S" + joined + elif len(room_list) == 0: + return amphis else: - return "Salle {0}".format(joined) + return amphis + ", s" + joined -- cgit v1.2.1