I made a custom template filter (ref_href) which converts numbered
references (like [1], [2] etc) into footnote hyperlinks. It works but
requires the |safe filter which is dangerous.
To be actually safe I want to *only* use the |safe filter when the data
contains a numbered reference. Which I cannot do if it is permanently in
the template. In other words, I want to remove the |safe filter from the
template and incorporate it into my custom filter which checks that we
have an integer between the square brackets before doing its work.
Just thinking about it now, I suppose I could put a conditional in the
template ...
{% if "[" in value %}
{{ value | ref_href | safe }}
{% else %}
{{ value }}
{% endif %}
... but that's a lot of typing over dozens of templates. And it isn't
good enough.
Thanks for any secrets
Mike
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/524D14D9.5090605%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.