23👍
✅
Based on your settings and the file directory, the project root is the uppest app
directory. So that means that you import the models by writing:
from product.models import Product
instead of:
from api.product.models import Product
If your IDE suggested that import, something is probably wrong with the project root.
12👍
The solution I found that works for me using Python 3.x
...
from django.apps import apps
...
and then whereever in your code you need to import a model you can do the following.
...
model = apps.get_model('app_name', 'ModelName')
...
- Django __call__() missing 1 required keyword-only argument: 'manager'
- How to disable HTML encoding when using Context in django
- DjangoRestFramework HTTPS Links With Routers and Viewsets
Source:stackexchange.com