Search code examples
pythondjangodjango-templatesqr-code

Nested Django tags


I am using the QR code (Django) library and when I do {% qrcode_from_text "{% url 'foo' %}" "l" %}, the inner tag gives error. Is there any way to do such nested django template tags? Thanks.


Solution

  • No, but you don't need to. The url tag has a syntax to save the result to a variable:

    {% url 'foo' as foo_url %}
    

    and you can then use that in your custom tag:

    {% qrcode_from_text foo_url %}