flo...@gmail.com wrote:
> I have a custom filter that does just this that I use in virtually
> every single Django project I use.  It's such a common pattern that it
> seems almost silly not to have it included in core.  It's also small
> enough that it won't add much in the way of maintenance.  Also, there
> already exists a truncate_words, which has nice symmetry with the
> proposed name.  Finally, as has been said before, it's something that
> new users intuitively expect to find, so let's not disappoint them.
>
> I quite strongly feel that slice is not a suitable alternative,
> because 1) adding the ellipses requires a non-trivial amount of
> additional template logic (and this logic need be repeated every time
> ellipses are wanted) and 2) it makes the actual markup of the template
> less semantically relevant.
>
> Count me as a big +1 for including this.
>
> Thanks,
> Eric Florenzano
>
>   

Agree +1 on including it into Django.
(both truncate and truncate_html)

I'm having similar experiences as Eric, think 7 out of 10 sites
eventually use it in one way or another. To give some quick
examples; filenames, links, fullnames with hover, limiting user
generated content, csv exports, etc.

Sometimes in conjunction with truncate_words, like:

{{ content|truncate_words:40|truncate_letters:200 }

To make sure that text (mostly from user content, or scrapers)
get's limited to some fair amount even one words are extremely
long.

We also include it in django-extensions as truncate_letters.

It always seemed strange why truncate_words is included and
something to truncate letters isn't. Seems a logical pair

I also feel slice isn't an alternative, if it where then by the same
token we could remove truncate_words because you could also
split and slice. And it means repeating yourself many times over
when it can be solved with a simple template_tag.

Regards,
Bas

--

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