I am trying to output the first 255 characters of a description on a list of items and am looking for a method to get that.
Example: I have a variable that contains 300 or so characters.
I call that variable like this, {{ my_variable|characterlimit:255 }}
and it would return only the first 255 characters of that variable.
If this tag doesn't exist, I will simply create it (and suggest that it goes into django), but I wanted to make sure it didn't before I took the time to do that. Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…