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 に答える