Hello, reader!

My name is Eugene Lazutkin.

I'm a software developer based in the Dallas-Fort Worth metroplex. Lazutkin.com is my professional blog, which contains short writeups and presentations regarding modern web applications. All articles here are written by myself, unless stated otherwise.

Migration to magic-removal

Today I converted three web sites to the latest Django’s trunk formerly known as the magic-removal branch. It was a very positive experience in general. New Database API with lazy database queries (courtesy of QuerySet) rocks! Direct interaction with model classes allows doing a lot of things much simpler than it was before. A lot of small improvements, which makes a big difference like explicit template extensions (use whatever is appropriate for your content), more transparent new Admin inner class, natural overriding of model methods (no more _pre_save() and _post_save() hooks!), and, of course, no more pluralization guessing.

I encountered exactly three small problems during the conversion:

  • RemovingTheMagic is a formidable encyclopedia of changes but it is difficult to use it as a cheatsheet for the conversion, because it is not organized by functional areas, and requires modifying files in several passes. I filed the enhancement ticket #1786.
  • I had small problems modifying users and groups after the conversion. Instead of change screeens I started to get 404 pages without any helpful traces. I had to regenerate permission tables. The enhancement ticket #1787 shows how I did that.
  • I found get_list_or_404() being less flexible than before. I used to pass in __ne and order_by kwargs, which I cannot do anymore, because they are not recognized as proper keywords. I had to do it manually with exclude() and order_by(), which was not a big deal because get_list_or_404() has a very small body.

In general the whole process was painless and left me completely satisfied with the outcome and code changes. Thanks to all contributors, who made it possible!