[Django]-What is the equivalent of django.db.models.loading.get_model() in Django 1.9?

85👍

django.db.models.loading.get_model() has been removed in django 1.9.

You are supposed to use django.apps instead.

>>> from django.apps import apps
>>> apps.get_model('shop', 'Product')
<class 'shop.models.Product'>
>>> 

Django docs reference

👤v1k45

Leave a comment