On Dec 29, 9:08 pm, James Bennett <ubernost...@gmail.com> wrote:

> It is built in, though, it's just called "slice". The only thing
> people seem to offer to differentiate this proposal from the existing
> filter is that the proposed "truncate" would add an ellipsis at the
> end, and honestly I'm not really convinced that's a significant enough
> use case to warrant adding another built-in filter.

For what it's worth, it's something I've wanted (and wondered about)
for several of my projects, and I've heard the same from others. It
seems to me that more often than not, developers want an ellipsis when
truncating strings like that.

I thought about suggesting adding an option to the existing slice
filter but I really think that's its own use case and that there
should be a new truncatestring filter that matches the syntax of
truncatewords.

It's especially unclear to new developers that they should accomplish
this with slice (and an if statement checking the length of the
string) - and it's not very DRY. The convenience of having slice is
undermined by the fact that many aren't clever enough to use it this
way - it certainly didn't occur to me.

So, +1 to this idea.

John

--

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