Skip to content Skip to sidebar Skip to footer

Import Error :cannot Import Name Get_model

File 'C:\Python27\Lib\site-packages\file_picker\forms.py,line 5 in from django.db.models import Q,get_model ImportError:cannot import name get_model I am using dja

Solution 1:

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


Solution 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.


Post a Comment for "Import Error :cannot Import Name Get_model"