Using django: Google App Engine: How to Truncate string after a given number of chars on newest questions tagged django – Stack Overflow
I am on Google App Eninge with Django template.
UPDATE:
OK! A lot of people dont seem to get me! I need to truncate the string in Django Template not in python source code! Something like this: {{ string|truncatesmart:50 }}
I want to truncate string after a given number of chars, for example,
if a string (a title of a post) is too long, “This is a long long long long title”, I want to display the first few words, like this: “This is a long long …”
I have found some Django snippets here: http://djangosnippets.org/snippets/1259/ http://djangosnippets.org/snippets/763/
I want to know:
-
If there is a simpler solution in Google App Engine python?
-
How can I use this snippet http://djangosnippets.org/snippets/1259/
in App Engine? I believe messing source code is not a good idea.
Thanks a lot!
source: http://stackoverflow.com/questions/10728619/google-app-engine-how-to-truncate-string-after-a-given-number-of-chars
Using django: using-django
Recent Comments