Saturday, February 28, 2015

Problem installing and using smart_selects


Smart Selects looked so simple and promising for chained selects (https://github.com/digi604/django-smart-selects).  However, no matter how I install it, it doesn't seem to work.  Here is what I've tried:


Attempt #1 - putting it in django.contrib

Copied the smart_selects folder to /django/contrib/smart_selects

Added "django.contrib.smart_selects" to INSTALLED_APPS in settings.py

But within Django shell I got this error:

>>>  from django.contrib import smart_selects
>>>  smart_selects.urls
AttributeError: 'module' object has no attribute 'urls'



Attempt #2 - installed using pip

I removed the smart_selects folder from /django/contrib  folder (above) and then installed using pip... which put smart_selects in the Python site-packages folder.

But then trying to use smart_selects within urls.py produced an ugly "ImportError: cannot import name simplejson" which suggests smart_selects has some outdated dependencies. (I"m using Django 1.7).



Attemp #3 - putting smart_packages in the root folder of my Django project

When smart_selects is placed here, again I can import smart_selects from the Django shell  but not access smart-selects.urls :

Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import smart_selects
>>> dir(smart_selects)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'models']
>>> smart_selects.urls
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'urls'


Finally it works if i do this:

>>> import smart_selects.urls
>>> smart_selects.urls
<module 'smart_selects.urls' from '/Users/chas/Projects/switch/djangoroot/smart_selects/urls.pyc'>



However, I really don't like putting apps here since they clutter up my own development (and would rather keep 3rd party apps in django/contrib). 

What am I missing about the smart_selects ?
Thank you,

Mike,

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1034ee57-88fc-417e-a9d6-b5787815ffb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment