Fix migrations for custom user model

This fix migrations when running then the first time
with the project configured to use a custom user,
while being compatible with django < 1.5

Signed-off-by: Fernando Rocha <fernandogrd@gmail.com>
Merge remote-tracking branch 'fernandogrd/master'