Skip to main content

A Django template filter that wraps around profanity-check

Project description

django-profanity-check

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-profanity-check-0.1.0.tar.gz (3.3 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page