[Django]-Import Error :cannot import name get_model

9👍

Try using django.apps instead:

from django.apps import apps

apps.get_model('Model')

https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.AppConfig.get_model

2👍

Try this,

from django.apps import apps

model_obj = get_model('app_name', 'model_name')

Where “app_name” is your app name and “model_name” is your model name.

Leave a comment