0
私は既存のモデル/管理者をdjango-polymorphicに変換しています。私はモデルと移行が正常に完了していると思いますが(少なくとも、シェルで動作しています)、管理者を働かせることはできません。私はdocumentationが少し曖昧だと思っていますが、私はそれを正しく追ってきたと思います。例外値: 'PolymorphicModelBase'タイプのオブジェクトにlen()がありません
class LibraryItemAdmin(PolymorphicParentModelAdmin):
base_model = LibraryItem
child_models = (Whitepaper)
class LibraryItemChildAdmin(PolymorphicChildModelAdmin):
base_model = LibraryItem
class WhitepaperAdmin(LibraryItemChildAdmin):
form = LibraryForm
base_model = Whitepaper
私は問題を理解していない:
Traceback:
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
108. response = middleware_method(request)
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/middleware/common.py" in process_request
74. if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in is_valid_path
646. resolve(path, urlconf)
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
521. return get_resolver(urlconf).resolve(path)
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
365. for pattern in self.url_patterns:
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
401. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
395. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/srv/www/urls.py" in <module>
349. url(r'^admin/', include(admin.site.urls), name='admin'),
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in urls
291. return self.get_urls(), 'admin', self.name
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in get_urls
275. url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name), include(model_admin.urls)),
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in urls
631. return self.get_urls()
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/polymorphic/admin/parentadmin.py" in get_urls
283. self._lazy_setup()
File "/root/.virtualenvs/divesite/local/lib/python2.7/site-packages/polymorphic/admin/parentadmin.py" in _lazy_setup
92. self._compat_mode = len(child_models) and isinstance(child_models[0], (list, tuple))
Exception Type: TypeError at /admin/library
Exception Value: object of type 'PolymorphicModelBase' has no len()