adapt to django 1.6 db API