KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm using Django 1.3. If I put the following fragment into my template: {% if 'my string'|length > 10 %}{{ 'my string'|length }}{% endif %} the rendering engine prints '9'. The only thing I can think of is that the |length filter is returning a string, but that seems odd in the extreme. Can anyone point me in the right direction? Thanks! Edit: The length I actually want to test comes from flatpage.title provided by django.contrib.flatpages . For this reason, I'd rather not hack the view to provide the information I need to the template. I'd hoped I could simply use the |length filter as described in the Django docs, here . However, as has been pointed out, the only way to do this seems to be to also use the |get_digit filter, whose behaviour is not clearly defined in this respect. :(
Tags (comma-separated)
Save Edits
Cancel