diff --git a/shiftregister/team/templates/helper_detail.html b/shiftregister/team/templates/helper_detail.html index 103ea72..fdd60e5 100644 --- a/shiftregister/team/templates/helper_detail.html +++ b/shiftregister/team/templates/helper_detail.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load humanize %} +{% load striplogintoken %} {% block title %}Helferdetails{% endblock %} @@ -22,7 +23,7 @@
- {{ content }} + {{ content | striplogintoken }} {% if created_at %}
{{ created_at | naturaltime }} diff --git a/shiftregister/team/templates/incoming_message.html b/shiftregister/team/templates/incoming_message.html index 48a6e9a..121339d 100644 --- a/shiftregister/team/templates/incoming_message.html +++ b/shiftregister/team/templates/incoming_message.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load humanize %} +{% load striplogintoken %} {% block title %}Nachricht von {{ message.sender }}{% endblock %} @@ -11,7 +12,7 @@
- {{ message.content }} + {{ message.content | striplogintoken }}
{% if not message.read %} diff --git a/shiftregister/team/templates/incoming_messages.html b/shiftregister/team/templates/incoming_messages.html index d113458..da82293 100644 --- a/shiftregister/team/templates/incoming_messages.html +++ b/shiftregister/team/templates/incoming_messages.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load humanize %} +{% load striplogintoken %} {% block title %}Sie haben {{ num_unread | apnumber }} neue Nachricht{{ num_unread | pluralize:"en" }}{% endblock %} @@ -13,7 +14,7 @@ {{ message.display_sender }} {{ message.created_at | naturaltime }}
- {{ message.content }} + {{ message.content | striplogintoken }}
diff --git a/shiftregister/team/templatetags/__init__.py b/shiftregister/team/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/shiftregister/team/templatetags/striplogintoken.py b/shiftregister/team/templatetags/striplogintoken.py new file mode 100644 index 0000000..acc059a --- /dev/null +++ b/shiftregister/team/templatetags/striplogintoken.py @@ -0,0 +1,9 @@ +from django import template +from re import ASCII, sub + +register = template.Library() + + +@register.filter(name="striplogintoken") +def strip_login_token(value): + return sub(r'https://helfen\.kntkt\.de/l/[-\w]+', '(zurückbehalten)', value, flags=ASCII)