Filter; Capitalise Sentences (capsentence)

1
2
3
4
5
6
7
8
9
from django import template

register = template.Library()

@register.filter
#capitalise the first letter of each sentence in a string
def capsentence(value):
    value = value.lower()
    return ". ".join([sentence.capitalize() for sentence in value.split(". ")])

More like this

  1. Convert String Uppercase and Lowercase by oraculum 2 years, 1 month ago
  2. db_dump.py - for dumpping and loading data from database by limodou 6 years, 2 months ago
  3. CategoriesField by fongandrew 3 years, 9 months ago
  4. truncate letters by trbs 6 years, 2 months ago
  5. Amazon product-data interface class for Django-friendly PyAWS queries by fish2000 3 years, 3 months ago

Comments

(Forgotten your password?)