[Django]-Django app post_save with sender=get_user_model()

3๐Ÿ‘

I just updated a project from 1.7 to 1.8 and ran into this issue.

I was replacing old 'auth.User'and django.contrib.auth.models.Userreferences and stumbled upon the following error:

django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

Reading through the traceback I found out that I did the following in my models.py:

models.signals.post_save.connect(create_user_profile, sender=get_user_model())

This is the second time I got that issue, so the following might be a solution to others. Simply replace the get_user_modelfunction with a string or setting:

models.signals.post_save.connect(create_user_profile, sender=settings.AUTH_USER_MODEL)
๐Ÿ‘คTobias Lorenz

Leave a comment