Opened 6 years ago

Closed 6 years ago

Last modified 6 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


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 Changed 6 years ago by Luke Plant

Resolution: invalid
Status: newclosed

comment:2 Changed 6 years ago by Stefano Vettorazzi Campos

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