rnegron / django-profanity-check

A Django template filter that wraps around profanity-check

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django-profanity-check

Build Status codecov pypi version Packaged with poetry Code Style

A Django template filter that wraps around profanity-check.

Note: numpy, scipy, and scikit-learn are all dependencies of profanity-check.

Usage

  1. Install with pip.

    pip install django-profanity-check
    
  2. Add profanity to your INSTALLED_APPS.

    # settings.py
    
    INSTALLED_APPS = [ ..., 'profanity', ...]
  3. Use it in a template!

    {# ... #}
    
    {% load profanity %}
    
    {# ... #}
    
    {% with sentence='Hey, fuck you!' %}
       {{ sentence | censor }} {# Will result in: 'Hey, **** you!' #}
    {% endwith %}
    
    

Todo

  • Allow custom replacement characters
  • Allow custom replacement character length
  • Template tests

Credits

Victor Zhou's profanity-check Python package does all the heavy lifting.

Inspired by django-profanity-filter.

About

A Django template filter that wraps around profanity-check

License:MIT License


Languages

Language:Python 100.0%