M
M
michael ivanov2015-07-16 11:23:47
Django
michael ivanov, 2015-07-16 11:23:47

How to get the first 30 characters from a db text field in django?

How to get the first 30 characters from a db text field in django?
Well, i.e. I have an Article model with a full_story field.
How can I display the first 30 characters from this field in the template?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Lyutoev, 2015-07-16
@pauchenkov

In the template {{ full_story|truncatechars:30 }}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question