code update to Django 1.6