[1.7.x] Reordered condition to avoid calling allow_migrate() if unneeded.
[1.7.x] Reordered condition to avoid calling allow_migrate() if unneeded.

Backport of 82aca216e130973d142473ebb4b22d1eae146ec7 from master

oscaro/django,jyotsna1820/django,jyotsna1820/django,oscaro/django,oscaro/django,oscaro/django,jyotsna1820/django,jyotsna1820/django