Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#19278 closed New feature (invalid)

Return the string after a certain number of words

Reported by: esevece 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 Changed 3 years ago by lukeplant

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

comment:2 Changed 3 years ago by esevece

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