1 2 3 4 5 6 7 8 9 10 11 12 | from django.template.defaultfilters import stringfilter
from django.template.defaulttags import register
@stringfilter
@register.filter
def assert_period(str):
"""Makes sure a string ends with a period."""
if str[-1].isalnum():
return "%s." % str
else:
return str
|
More like this
- Sophisticated order_by sorting by mawi 6 months, 1 week ago
- "Zoom in" on rendered HTML that the test client returns by peterbe 4 years, 2 months ago
- Fuzzy Time of Day by waylan 6 years ago
- Create multiple related objects at once by yaniv.haber 4 years, 2 months ago
- CSVImport by sharkus 5 years ago
Comments