From da45ebae45126fb7c0d311752cb583335aff3eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Mon, 17 Oct 2016 00:47:04 +0200 Subject: [PATCH] program: merge cell horizontally --- planning/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/planning/utils.py b/planning/utils.py index d2df33a..62e3fa7 100644 --- a/planning/utils.py +++ b/planning/utils.py @@ -74,8 +74,9 @@ class Program: for ts, rooms in self.rows.items(): content = '' for room, events in rooms.items(): + colspan = 1 for i in range(self.cols[room]): - options = '' + options = ' colspan="%d"' % colspan cellcontent = '' if i < len(events) and events[i]: event = events[i] @@ -83,6 +84,10 @@ class Program: continue options = ' rowspan="%d" bgcolor="%s"' % (event.rowcount, event.talk.event.color) cellcontent = str(event.talk) + ' — ' + event.talk.get_speakers_str() + elif (i+1 > len(events) or not events[i+1]) and i+1 < self.cols[room]: + colspan += 1 + continue + colspan = 1 content += cell % {'options': options, 'content': escape(cellcontent)} style, timeslot = self._timeslot(ts) output.append(row % {