5👍
✅
As far as I know there were changes in import system in Python 3. Just be more specific about what you want to import. I assume you want to import forms.py
from contacts
so
from contacts import forms
or you can try
import .forms
👤twil
0👍
It’s propper to do it like this:
from forms import FormClassName
Or you can
from forms import *
but it’s not nessesary.
From other apps you must
from contacts.forms import FormClassName # or wildcard '*'
- [Django]-Django localization: labels don't get updated
- [Django]-Django: m2m_changed not fired when end of relation is deleted
- [Django]-Formatting inline many-to-many related models presented in django admin
- [Django]-Python/Django AMQP?
0👍
When importing the directory which python searches for import is project root and there is no module named as forms.
So if you wanna test create a file named forms in project root and it will import it.
That way following will surely work
from contacts.forms import FormClassName # or wildcard '*'
👤Nish
- [Django]-No module named django.core when running django-admin startproject myproject
- [Django]-Django-signal receiver doesn't work although connected in the ready() method
- [Django]-Django admin change-list optimizing query: select field1, field2 instead of select *
Source:stackexchange.com