Links published on June 14, 2006

1 link published on this date. See also: all links published in June 2006, latest links.

Custom SQL in Django

Malcolm has been building up to this for a couple of days, and it’s really worth reading the entire progression:

  1. First he posed a puzzle: find the best way to perform a certain operation in SQL.
  2. Then he offered a couple of solutions, one that’s quick and dirty and one that’s more elegant and efficient.
  3. Finally he explains how to use a custom manager to make this easy as pie in Django.

Custom managers are another of those great relatively-untapped features of Django that really make life a whole lot easier — I use a couple of them on this site to help save keystrokes on certain common database operations, for example. There’s a little bit of official documentation on them, but they’re a relatively new concept (having recently been merged in from a long-running development branch) and it’s great to see a concrete example of what they can do.

Visit site or read comments.

Links published on June 15, 2006