I want to use get_model() to avoid cyclic imports in my models, but I get name \'get_model\' is not defined error. I read that get_model()
get_model()
name \'get_model\' is not defined
django.db.models.loading.get_model() has been removed in django 1.9.
django.db.models.loading.get_model()
You are supposed to use django.apps instead.
django.apps
>>> from django.apps import apps >>> apps.get_model('shop', 'Product') <class 'shop.models.Product'> >>>
Django docs reference