Filter
Dynamic Length Truncate Tag
Wednesday, April 2nd, 2008Almost a year ago I wrote about Simple Character Truncate Filter And Dot Dot Dot Variant which was a basic string truncate written as a Django filter. It worked great until I needed to dynamically specify the length. Turns out filters are not good at resolving context variables (at least I dont know [...]
Simple Character Truncate Filter And Dot Dot Dot Variant
Monday, June 18th, 2007A basic filter tag for truncating long strings and optionally appending a "…". I used this to clean up long URLS at Arkayne. See list on right side of main page.
Background
Say you have:
http://www.someverylongurl.com/with/lots/of/characters/that/dont/fit/in/a/line
You want to display only 40 chars:
http://www.someverylongurl.com/lots/o…
Code
The implementation for the plain and dot dot dot filter is wrapped into one file. [...]