Login

Snippets by Eloff

Snippet List

django-admin custom filter: IS NULL/IS NOT NULL

A simple django-admin filter to allow a boolean-like filter for IS NULL/IS NOT NULL. By default it applies to CharField, IntegerField, and FileField, but you can change this by editing NullFilterSpec.fields.

  • filter
  • admin
  • null
  • filterspec
Read More

HTML Prettifier

Tired of scrolling through hundreds of lines of code where the indentation is maddening? Here's a middleware class that prettifys your html markup so it's nice and consistently indented. Intended only for debugging, and I add it to the middleware stack conditionally on TEMPLATE_DEBUG. Requires BeautifulSoup.

  • html
  • pretty
  • prettify
  • ugly
  • indented
Read More

Eloff has posted 2 snippets.