Question

i am trying to make a smart menu using ChainedForeignKey, but so far i am stuck with the import of ChainedForeignKey:

from smart_selects.db_fields import ChainedForeignKey 

I am using pydev on Eclipse. I downloaded the smart select package here: http://pydoc.net/Python/django-smart-selects/1.0.2/ and added it to my PYTHONPATH

when i debug i get:

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'

Any help appreciated

Was it helpful?

Solution

Marking the comment as answer for future reference:

Looks like ADMIN_MEDIA_PREFIX was not set.

Setting ADMIN_MEDIA_PREFIX='/static/' or any other appropriate value for ADMIN media would fix the issue

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top