Gần đây tôi đã chuyển sang một máy khác và phải kiểm tra dự án của mình từ lật đổ một lần nữa, nhưng tôi khá chắc chắn máy tính này có Django 1.8 và dự án đang mong đợi 1.7.django.core.exceptions.ImproperlyConfigured
Tôi đã cố gắng đồng bộ hóa db của mình với mã để tạo các bảng cần thiết nhưng tôi nhận được lỗi sau.
C:\Users\jont\Documents\ATP\Webapp>manage.py syncdb
C:\Python27\lib\site-packages\admin_tools\utils.py:9: RemovedInDjango19Warning:
django.utils.importlib will be removed in Django 1.9.
from django.utils.importlib import import_module
c:\users\jont\documents\django-trunk\django\contrib\contenttypes\models.py:148:
RemovedInDjango19Warning: Model class django.contrib.contenttypes.models.ContentType doesn't de
her isn't in an application in INSTALLED_APPS or else was imported before its application was
loaded. This will no longer be supported in Django 1.9.
class ContentType(models.Model):
C:\Python27\lib\site-packages\admin_tools\dashboard\modules.py:8: RemovedInDjango19Warning: The
django.forms.util module has been renamed. Use django.forms.utils instead.
from django.forms.util import flatatt
C:\Python27\lib\site-packages\django_tables2\tables.py:171: RemovedInDjango19Warning: SortedDict
is deprecated and will be removed in Django 1.9. attrs["base_columns"] =
SortedDict(parent_columns)
C:\Python27\lib\site-packages\django_tables2\tables.py:193: RemovedInDjango19Warning: SortedDict
is deprecated and will be removed in Django 1.9.
attrs["base_columns"].update(SortedDict(cols))
Traceback (most recent call last):
File "C:\Users\jont\Documents\ATP\Webapp\manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "c:\users\jont\documents\django-trunk\django\core\management\__init__.py", line 336, in
execute_from_command_line
utility.execute()
File "c:\users\jont\documents\django-trunk\django\core\management\__init__.py", line 310, in
execute
django.setup()
File "c:\users\jont\documents\django-trunk\django\__init__.py", line 23, in setup
apps.populate(settings.INSTALLED_APPS)
File "c:\users\jont\documents\django-trunk\django\apps\registry.py", line 115, in populate
app_config.ready()
File "c:\users\jont\documents\django-trunk\django\contrib\admin\apps.py", line 22, in ready
self.module.autodiscover()
File "c:\users\jont\documents\django-trunk\django\contrib\admin\__init__.py", line 24, in
autodiscover
autodiscover_modules('admin', register_to=site)
File "c:\users\jont\documents\django-trunk\django\utils\module_loading.py", line 73, in
autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\jont\Documents\ATP\Webapp\jobs\admin.py", line 4, in <module>
from jobs.views import registration
File "C:\Users\jont\Documents\ATP\Webapp\jobs\views.py", line 12, in <module>
from jobs.forms import ApplicantForm, JobForm, \
File "C:\Users\jont\Documents\ATP\Webapp\jobs\forms.py", line 8, in <module>
class JobForm(forms.ModelForm):
File "c:\users\jont\documents\django-trunk\django\forms\models.py", line 272, in __new__
"needs updating." % name
django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form JobForm needs updating.
django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form JobForm needs updating.
Cảm ơn bạn @ karthikr, tôi sẽ kiểm tra điều đó. Tuy nhiên, bây giờ, trở lại Django 1.7 dường như để khắc phục vấn đề. Tôi hy vọng có một vài thay đổi cần phải được thực hiện cho mã của tôi nếu tôi đã đi đến 1.8 – Jon
Nó có vẻ như điều này đặt ra một ngoại lệ cho django 1.8. Nó chỉ ném một cảnh báo trong django 1.7, mà nó có thể là giá trị cập nhật các modelforms anyway .. – karthikr
'fields =" __ all __ "' cũng được yêu cầu như một tham số cho 'inlineformset_factory()' –