Fix two compatibility issues with django 1.7

1. With Django 1.7, during syncdb, AppRegistryNotReady exception raised in xadmin/models.py,
    Fix it following this suggestion in django document:
    https://docs.djangoproject.com/en/1.7/ref/applications/#troubleshooting

2. Fix login issue with django 1.7: check_for_test_cookie is deprecated and removed in django 1.7.