Opened 20 months ago

Closed 20 months ago

Last modified 20 months 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


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.

Attachments (0)

Change History (2)

comment:1 Changed 20 months 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 20 months 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.