1

我正在尝试使用 ChainedForeignKey 制作一个智能菜单,但到目前为止我一直坚持导入ChainedForeignKey

from smart_selects.db_fields import ChainedForeignKey 

我在 Eclipse 上使用 pydev。我在这里下载了智能选择包:http: //pydoc.net/Python/django-smart-selects/1.0.2/ 并将其添加到我的PYTHONPATH

当我调试时,我得到:

Traceback (most recent call last):
  File "C:\Users\Mr.Machine\Desktop\eclipse\plugins\org.python.pydev_2.7.0.2013032300\pysrc\pydevd.py", line 1397, in <module>
    debugger.run(setup['file'], None, None)
  File "C:\Users\Mr.Machine\Desktop\eclipse\plugins\org.python.pydev_2.7.0.2013032300\pysrc\pydevd.py", line 1090, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "C:\Users\Mr.Machine\Desktop\Workspace\Medbook\testApp\forms.py", line 4, in <module>
    from smart_selects.db_fields import ChainedForeignKey 
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\db_fields.py", line 2, in <module>
    import form_fields
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\form_fields.py", line 1, in <module>
    from smart_selects.widgets import ChainedSelect
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\widgets.py", line 20, in <module>
    class ChainedSelect(Select):
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\widgets.py", line 30, in ChainedSelect
    class Media:
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\widgets.py", line 33, in Media
    ('js/jquery.min.js', 'js/jquery.init.js')]
  File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 54, in __getattr__
    return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'ADMIN_MEDIA_PREFIX'

任何帮助表示赞赏

4

1 回答 1

1

将评论标记为答案以供将来参考:

好像ADMIN_MEDIA_PREFIX没有设置。

为 ADMIN 媒体设置ADMIN_MEDIA_PREFIX='/static/'或任何其他适当的值将解决问题

于 2013-05-08T17:59:10.523 回答