diff options
-rw-r--r-- | ogcp/__init__.py | 1 | ||||
-rw-r--r-- | ogcp/filters.py | 7 | ||||
-rw-r--r-- | ogcp/templates/macros.html | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/ogcp/__init__.py b/ogcp/__init__.py index 425e8f8..b0ef164 100644 --- a/ogcp/__init__.py +++ b/ogcp/__init__.py @@ -34,3 +34,4 @@ def localeselector(): return app.config.get('LANG', 'en') import ogcp.views +import ogcp.filters diff --git a/ogcp/filters.py b/ogcp/filters.py new file mode 100644 index 0000000..0d705a5 --- /dev/null +++ b/ogcp/filters.py @@ -0,0 +1,7 @@ +from ogcp import app +import re + +@app.template_filter('remove_id') +def remove_id(s): + return re.sub(r'_\d+$', '', s) + diff --git a/ogcp/templates/macros.html b/ogcp/templates/macros.html index 0d1ebe2..fb7c311 100644 --- a/ogcp/templates/macros.html +++ b/ogcp/templates/macros.html @@ -104,7 +104,7 @@ {% set max_clients = 50 %} {% for name_id, ip in selected_clients[:max_clients] %} <div id="pill-{{ name_id|replace(".", "_")|replace(" ", "_") }}" class="badge badge-pill og-pill badge-light"> - {{ name_id }}<br>{{ ip }} + {{ name_id|remove_id }}<br>{{ ip }} </div> {% if loop.last and (selected_clients|length > max_clients) %} <div class="badge badge-pill badge-light">...</div> |