Could not parse the remainder Django

前端 未结 2 1541
忘掉有多难
忘掉有多难 2021-01-19 01:35

I\'ve been trying to write a custom template tag to shorten links with bitly, I\'ve attached the code and error I\'ve been getting below. I\'ve tried to look into the docume

相关标签:
2条回答
  • 2021-01-19 01:57

    There is an alternative way to cause this error:

    Instead of:

    {{ data|filter }}
    

    If you use:

    {{ data | filter }}  <!-- Note Spaces -->
    

    The spaces on either side of the | character will cause an exception during page render.

    0 讨论(0)
  • 2021-01-19 02:02

    The error is on this line:

    <p>{{ bitlyshort "http://www.google.com" }}</p>
    

    Template tags use {% ... %} (template filters use {{ ... }}). Try:

    <p>{% bitlyshort "http://www.google.com" %}</p>
    
    0 讨论(0)
提交回复
热议问题