bp guidelines link to new site
This commit is contained in:
parent
6f33e587c6
commit
1b8bcd7000
|
@ -18,4 +18,19 @@ def link_bps(value):
|
|||
value = value.replace(match, '', 1)
|
||||
return value
|
||||
|
||||
def abs_link_bps(value):
|
||||
r = r'BP\:[0-9][0-9]?'
|
||||
matches = re.findall(r, value)
|
||||
for match in matches:
|
||||
id = int(match.replace("BP:", "").strip())
|
||||
try:
|
||||
bp = BestPractice.objects.get(pk=id)
|
||||
title = bp.title
|
||||
html = "<a class='bpRelated' href='%s' title='View related Best Practice story'>%s</a>" % (bp.get_absolute_url(), title,)
|
||||
value = value.replace(match, html, 1)
|
||||
except:
|
||||
value = value.replace(match, '', 1)
|
||||
return value
|
||||
|
||||
register.filter("abs_link_bps", abs_link_bps)
|
||||
register.filter("link_bps", link_bps)
|
||||
|
|
|
@ -17,6 +17,6 @@
|
|||
</div>
|
||||
<div class="">
|
||||
{% autoescape off %}
|
||||
{{ text|linebreaksbr|link_bps }}
|
||||
{{ text|linebreaksbr|abs_link_bps }}
|
||||
{% endautoescape %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user