Fix migrations to work with custom user models, check sorl.thumbnail installed in migrations

Move compatibility functions to compat.py module
force to use language from user's forum profile