1 2 3 4 5 6 7 8 9 10 11 | from django import template
register = template.Library()
@register.filter
# truncate after a certain number of characters
def truncchar(value, arg):
if len(value) < arg:
return value
else:
return value[:arg] + '...'
|
More like this
- truncate letters by trbs 4 years, 10 months ago
- truncatestring filter by pigletto 2 years, 11 months ago
- Truncate filter by zalun 2 years, 9 months ago
- Inline truncate by character number by esanchez 3 years, 7 months ago
- Precise truncate chars filter by davmuz 2 weeks, 5 days ago
Comments