Limit the output of a field

1
2
3
4
5
def limitfield (self,obj):
     if  len(obj.field) < 30:
       return obj.field
     else:
       return obj.field[:26]+'...'

More like this

  1. SuperChoices by willhardy 4 years, 6 months ago
  2. really_equals by zeeg 6 years ago
  3. Improved Pickled Object Field by taavi223 3 years, 9 months ago
  4. Math Captcha Field and Widget by btaylordesign 1 year, 8 months ago
  5. Precise truncate chars filter by davmuz 1 year, 4 months ago

Comments

(Forgotten your password?)