10👍
✅
In Python 3 you must tell it when you are using relative imports:
from .models import ...
0👍
I have always used:
from myapp.models import ...
Rather than a relative import. Just my personal preference. Perhaps relative import makes more sense if it is the admin.py
for myapp
, but I still like the explicitness of having the app name in the import.
- [Django]-How to make a geography field unique?
- [Django]-Django Custom User Model Best Practice: User = get_user_model()?
Source:stackexchange.com