Fix migrations when using 1.5+ custom user model

Adds new compat module to abstract getting the user model, updates migrations and models to use this.