Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19278 closed New feature (invalid)

Return the string after a certain number of words

Reported by: Stefano Vettorazzi Campos Owned by: nobody
Component: Template system Version: 1.4
Severity: Normal Keywords: truncatewords
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I don't know how to explain the feature that I want. This example can help.

I have a text:
"My name is Stefano and I'm from Uruguay."

And I want to show:
"My name is Stefano...
...and I'm from Uruguay"

I'm using truncatewords for the first line.

Change History (2)

comment:1 by Luke Plant, 12 years ago

Resolution: invalid
Status: newclosed

comment:2 by Stefano Vettorazzi Campos, 12 years ago

I've found the solution: {{ my_text.split|slice:'4:'|join:' ' }}
But it would be great to have a filter like 'truncatewords' for this.

Note: See TracTickets for help on using tickets.
Back to Top