Tôi đang làm việc với eav-django (thuộc tính-thuộc tính-giá trị) trong django 1.9. Bất cứ khi nào tôi đã thực hiện lệnh ./manage.py runserver
, tôi đã nhận lỗi:NhậpError: không thể nhập tên chung chung
Unhandled exception in thread started by <function wrapper at 0x10385b500>
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/Django-1.9-py2.7.egg/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Library/Python/2.7/site-packages/Django-1.9-py2.7.egg/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Library/Python/2.7/site-packages/Django-1.9-py2.7.egg/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/Library/Python/2.7/site-packages/Django-1.9-py2.7.egg/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Library/Python/2.7/site-packages/Django-1.9-py2.7.egg/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Python/2.7/site-packages/Django-1.9-py2.7.egg/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Library/Python/2.7/site-packages/Django-1.9-py2.7.egg/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/shakil_grofers/src/django-eav/eav/models.py", line 42, in <module>
from django.contrib.contenttypes import generic
Tôi cố gắng để nhập chung bằng cách thêm:
from django.contrib.contenttypes import generic
trong models.py. Sau đó, sau vài nghiên cứu tôi phát hiện ra rằng generic đã không được chấp nhận trong Django 1.7 và không còn ở Django 1.9. Bất cứ ai có thể cho tôi biết trong đó thư viện khác chức năng này đã được thêm vào trong Django 1.9 và làm thế nào để sử dụng nó?
bạn có thể đề xuất cách sử dụng eav-django bằng cách này không ?? –
Bạn cần sửa đổi mã nguồn 'django-eav' và thay thế tất cả' generic.GenericForeignKey 'bằng' fields.GenericForeignKey'. Bạn cũng có thể thực hiện yêu cầu kéo đến kho lưu trữ trong khi bạn đang ở đó :) https://github.com/mvpdev/django-eav/ – Selcuk