On Dec 30, 2009, at 6:06 AM, Russell Keith-Magee wrote:
> Firstly, as James points out, slice already exists, and the ellipsis
> difference between slice and truncate can be easily overcome with
> additional code.

In the past I have had the need for a filter that works not just on the end of 
the string but sometimes in the middle. For example truncating a long filename, 
you might want to show the first bit and the last it.

myfilewithasuperlong...thisnameisreallylong.jpg

Doing this in the template is not a good idea, but with a template filter you 
can do it with an extra argument.

+1

--

You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.


Reply via email to