1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from django import template
from post.models import AuditWord
from datetime import datetime
register = template.Library()
_bad_words = [aw.word for aw in AuditWord.objects.filter(is_published=True)]
@register.filter
def audit(value):
for word in _bad_words:
if word in value:
value = value.replace(word,'*')
return value
|
More like this
- Truncate words by characters by trodrigues 3 years, 8 months ago
- truncatehtml_at_word by zakj 3 years, 3 months ago
- Word-boundary-aware string truncation template filter by josho 2 years, 8 months ago
- wordbreak filter by soniiic 2 years, 10 months ago
- Truncate string after a given number of chars keeping whole words by rix 3 years, 1 month ago
Comments