Login

Tag "cleanup"

Snippet List

Dead Code Finder

Rough check for unused methods in our apps. Scans models, views, utils, api, forms and signals files for what look like methods calls, then looks at all of our classes' methods to ensure each is called. Do not trust this blindly but it's a good way to get leads on what may be dead code. Assumes a setting called `LOCAL_APPS` so it only bothers to look at the code you've written rather than everything in `INSTALLED_APPS`.

  • refactor
  • cleanup
Read More

[UPDATE]Filter to resize a ImageField on demand + RATIO OPTION + CLEANUP

This is the snippet of rafacbd but upgraded... (http://djangosnippets.org/snippets/955/) Now support keep the aspect ratio or not, changing the size string (x1, x0) this choice use pil.resize or pil.thumbnail. Remember change the variable CAPS NAMES of the cleanup code. This cleanup function get the original main image file name and create a regexp similar to "[filename]_[width]x[height]x[ratio].[ext]" and remove all thumbs. By example if the main image is spain_rulez.jpg the script remove by example spain_rulez_100x100x1.jpg spain_rulez_200x150x0.jpg etc... etc...

  • template
  • image
  • thumbnail
  • cleanup
Read More

Cleanup dirty HTML from a WYSIWYG editor

My admin allows editing of some html fields using TinyMCE, so I end up with horrible code that contains lots of nested `<p>`, `<div>`, `<span>` tags, and style properties which destroy my layout and consistence. This tag based on lxml tries to kill as much unneeded tags as possible, and style properties. These properties can be customized by adapting the regex to your needs.

  • html
  • wysiwyg
  • tinymce
  • lxml
  • dirty
  • cleanup
Read More

3 snippets posted so far.