For me this works:
{{ game.description|safe }}
But this fails:
{{ game.description|safe|slice:"65" }}
Is there a way to apply two or more filters on a variable in Django templates?
In Sendwithus you can use the pluralize filter to change the suffix of a word. Like Django's pluralize filter it returns a plural suffix if the first argument is an integer greater than 1 or a sequence with more than 1 item. If a plural suffix isn't specified pluralize defaults to 's'.
{% %} and {{ }} are part of Django templating language. They are used to pass the variables from views to template. {% %} is basically used when you have an expression and are called tags while {{ }} is used to simply access the variable.
Django for loop counter All the variables related to the counter are listed below. forloop. counter: By using this, the iteration of the loop starts from index 1. forloop. counter0: By using this, the iteration of the loop starts from index 0.
Although it's quite past when the OP posted the question, but for other people that may need the info, this seems to work well for me:
You can rewrite
{{ game.description|safe|slice:"65" }}
as
{% with description=game.description|safe %} {{description|slice:"65"}} {% endwith %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With