I'm doing the following:
{% for wrapping in wrappings %} //array of strings
<input type="radio" value="{{ wrapping[:-3] }}" etc
I want to output all the string in wrapping minus the last 3 letters but am recieving a:
TemplateSyntaxError: Could not parse the remainder: '[:-3]' from 'wrapping[:-3]
.
Any idea what's wrong/how to do this please? Thanks,
You can just use the slice filter:
{{ wrapping|slice:":-3" }}
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