Is there a tag in Django to show part of the text?

Asked

Viewed 309 times

0

I wonder if there is a tag to show part of a description

{{ post.description | tag-aqui }}
  • By "a part" you mean limit the number of characters?

  • Yes, limit the number so that the full description is seen when detailing the post.

1 answer

1

Since the intention is only to limit the number of characters, just use the filter slice:

{{ post.description | slice:"0:255" }}

This way, characters in positions between 0 and 255 will be displayed.

Official documentation

Browser other questions tagged

You are not signed in. Login or sign up in order to post.