Fix imports that are incompatible with Django 1.6
Handle custom user model in migration