Make Proper Nouns Posessive

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import re
from django import template
register = template.Library()

@register.filter
def s(value):
    """
    Add an "'s" or "'" where appropriate on proper nouns to to make them posessive
    """
    if re.search(r's$', value):
        return value + "'"
    else:
        return value + "'s"

More like this

  1. split filter by Ciantic 6 years, 11 months ago
  2. HTTPS redirections middleware with updated URL template tag by xlq 1 year, 6 months ago
  3. template filter to include protocol and domain in absolute urls by czer 1 year, 9 months ago
  4. simple string formatting filter by gsf0 6 years, 7 months ago
  5. Filter by first letter inclusion tag by slafs 3 years, 11 months ago

Comments

(Forgotten your password?)