Login

Snippets by pkshiu

Snippet List

Template filter for formatting negative numbers

I have a need to conditionally format a negative number, a hedgefund's daily price change, Excel style. i.e. show a negative number as a parenthesized number instead of a negative sign. Here is a filter that will do that and more, solving a more general case. See the doctest for examples.

  • template
  • filter
  • format
  • currency
  • math
Read More

pkshiu has posted 1 snippet.