diff options
author | Alban Gruin | 2019-09-01 20:47:49 +0200 |
---|---|---|
committer | Alban Gruin | 2019-09-01 20:47:49 +0200 |
commit | 00d70c4d65967987c254c72f8bef5fda991f859b (patch) | |
tree | 670b2a78bfeb151096cfa844d6b48559dfc3641b /templatetags/rooms.py | |
parent | fe83f55800f78ff6ced9a13cf5a9c22fde0ead12 (diff) | |
parent | a6eaecf48f63c37cf851386a45cd4b25ac3ed1e0 (diff) |
Merge branch 'futur'
Diffstat (limited to 'templatetags/rooms.py')
-rw-r--r-- | templatetags/rooms.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/templatetags/rooms.py b/templatetags/rooms.py index f0e1b2e..d8b0e23 100644 --- a/templatetags/rooms.py +++ b/templatetags/rooms.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017 Alban Gruin +# Copyright (C) 2017, 2019 Alban Gruin # # celcatsanitizer is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -18,11 +18,17 @@ from django import template register = template.Library() +def __filter_room_name(name): + if '/' in name: + return name.split('/')[1].strip() + return name + + @register.filter def format_rooms(rooms): - 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")] + names = [__filter_room_name(room.name) for room in rooms] + amphi_list = [name for name in names if name.startswith("Amphi")] + room_list = [name for name in names if not name.startswith("Amphi")] amphis = ", ".join(amphi_list) joined = ", ".join(room_list) |