Skip to content
Snippets Groups Projects
Commit 62036eee authored by Benjamin Hättasch's avatar Benjamin Hättasch Committed by Nadja Geisler
Browse files

Add AK owner links to wiki export

This will try to automatically detect whether wiki or external links were used
Implements #90
parent 3d5f5de7
No related branches found
No related tags found
1 merge request!58Introduce confident AK messages to organizers and improve wiki export
Pipeline #8769 passed
{% extends "admin/base_site.html" %} {% extends "admin/base_site.html" %}
{% load tags_AKModel %}
{% block content %} {% block content %}
{% regroup AKs by category as ak_list %} {% regroup AKs by category as ak_list %}
...@@ -12,7 +14,7 @@ ...@@ -12,7 +14,7 @@
| name={{ ak.name }} | name={{ ak.name }}
| beschreibung= {{ ak.description }} | beschreibung= {{ ak.description }}
| wieviele={{ ak.interest_counter }} | wieviele={{ ak.interest_counter }}
| wer={{ ak.owners_list }} | wer={{ ak.owners|wiki_owners_export:ak.event }}
| wann= | wann=
| dauer={{ ak.durations_list }} | dauer={{ ak.durations_list }}
| reso={{ ak.reso }} | reso={{ ak.reso }}
......
...@@ -25,3 +25,17 @@ def message_bootstrap_class(tag): ...@@ -25,3 +25,17 @@ def message_bootstrap_class(tag):
elif tag == "warning": elif tag == "warning":
return "alert-warning" return "alert-warning"
return "alert-info" return "alert-info"
@register.filter
def wiki_owners_export(owners, event):
def to_link(owner):
if owner.link != '':
event_link_prefix, _ = event.base_url.rsplit("/", 1)
link_prefix, link_end = owner.link.rsplit("/", 1)
if event_link_prefix == link_prefix:
return f"[[{link_end}|{str(owner)}]]"
return f"[{owner.link} {str(owner)}]"
return str(owner)
return ", ".join(to_link(owner) for owner in owners.all())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment