Update code for Django 1.4