Hace unos pocos meses estuve trabajando en un proyecto con Django 1.6.5, Django-Select2 4.3.1 y Python 2.7 pero me solicitaron pasarla a Django 1.9
y Python 3.4
(No usaba virtualenvs, por tanto todo estaba global en el sistema (instalado con pip)).
Entonces tuve que empezar a usar un virtualenv para el nuevo proyecto y no he podido avanzar puesto que no me reconoce el paquete Django_Select2
, he intentado instalando desde el mismo origen y desde otros pero no me ha sido posible.
Esto es parte de mi archivo settings.py
:
AUTO_RENDER_SELECT2_STATICS = False
SELECT2_BOOTSTRAP = True
SHARED_APPS = [
'tenant_schemas', # obligatoria
...
'django_select2',
...
]
TENANT_APPS = [
'tenant_schemas', # obligatoria
...
'django_select2',
...
]
Y tengo algunos formularios que tienen esta parte en el encabezado:
from django_select2 import Select2MultipleWidget, Select2Widget
Esto sería parte de el archivo forms.py
:
class ActividadForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(ActividadForm, self).__init__(*args, **kwargs)
todos = Persona.objects.all()
...
class Meta:
model = Actividad
exclude = ('programador', 'estado_ejecucion', 'estado_revision')
widgets = {
'ejecutor': Select2Widget(),
'revisor': Select2Widget(),
...
'beneficiarios_contratistas': Select2MultipleWidget(),
...
}
Si escribo en la terminal python manage.py check
ésto es lo que me sale:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/management/commands/check.py", line 51, in handle
include_deployment_checks=include_deployment_checks,
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/carolina/Documentos/djcode/python3_virtual/proyectos/ripso_py3d19/ripso_v2/ripso_v2/urls.py", line 39, in <module>
url(r'^agenda/', include('agenda.urls')),
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/site-packages/django/conf/urls/__init__.py", line 52, in include
urlconf_module = import_module(urlconf_module)
File "/home/carolina/Documentos/djcode/python3_virtual/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/carolina/Documentos/djcode/python3_virtual/proyectos/ripso_py3d19/ripso_v2/agenda/urls.py", line 5, in <module>
from agenda import views
File "/home/carolina/Documentos/djcode/python3_virtual/proyectos/ripso_py3d19/ripso_v2/agenda/views.py", line 9, in <module>
from agenda.forms import *
File "/home/carolina/Documentos/djcode/python3_virtual/proyectos/ripso_py3d19/ripso_v2/agenda/forms.py", line 6, in <module>
from django_select2 import Select2MultipleWidget, Select2Widget
ImportError: cannot import name 'Select2MultipleWidget'
Podrían por favor ayudarme a solucionar este problema? (o indicarme otra forma de usar otro select2
si es el caso) cualquier información no expuesta aquí me la solicitan.