1👍
✅
You are making this more complicated than it needs to be.
Firstly, it seems that the only reason you need this to be interpreted as a template is so that it parses the url
tag. But there is already a way of creating links in Python code, and that is the reverse()
function. You should use that instead.
Secondly, the way to dynamically generate content for use inside a template is to use a custom template tag.
Source:stackexchange.com