开发者

Is there a way to automatically detect links in Django templates?

开发者 https://www.devze.com 2023-01-29 00:50 出处:网络
I am passing in some lists from a view into a django template. In this template, it will extract strings from these lists in a sequence of for loops, and then print out each of开发者_高级运维 these st

I am passing in some lists from a view into a django template. In this template, it will extract strings from these lists in a sequence of for loops, and then print out each of开发者_高级运维 these strings. Some of these strings may have URLs in them, like This is some string. http://google.com Right now when these strings are printed they are just printed as text. Is there a simple way to tell the django template to autolink these URLs and show these as links instead of plain text?

Thanks!


Try with urlize template tag.

0

精彩评论

暂无评论...
验证码 换一张
取 消