django-janitor

Allows you to use bleach to clean HTML stored in a Model's field
Download

django-janitor Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Publisher Name:
  • Brad Montgomery

django-janitor Tags


django-janitor Description

Allows you to use bleach to clean HTML stored in a Model's field django-janitor is a Django app that allows you to use bleach to clean HTML stored in a Model's field.Installation:To install the most recent release:pip install django-janitorTo install from the current repository:pip intall hg+https://bitbucket.org/bkmontgomery/django-janitor/Usage:Browse to the Janitor app in Django's Admin, and create a new Field sanitizer. Then select the Model and specify the fieldname which should be cleaned. After you set up the whitelists for Tags, Attributes, etc, save the Field sanitizer.Then, when you save the Model to which the Field Sanitizer is associated, the content in the specified field will be cleaned using bleach.Management CommandsThere are two managment commands avaialable to make it easier to clean existing data. The first is clean_all which will look at all of the models that have a related Field Sanitizer, calling the models' save method to trigger the pre_save signal (which forces the fields to be cleaned):python manage.py clean_allThe second management command is clean_model, which works in a similar fashion, but allows you to specify an app and a model:python manage.py clean_model myapp.MyModel


django-janitor Related Software