google-code-export / django-page-cms

Automatically exported from code.google.com/p/django-page-cms
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Error with custom widget in placeholder #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If I specify a custom widget in {% placeholder %} tag like this

{% placeholder my_field with myapplication.MyCustomWidget %}

I get the following error in Page Edit form:

Traceback:
File
"/home/andrey/work/redsolution/abvi/parts/django/django/core/handlers/base.py"
in get_response
  86.                 response = callback(request, *callback_args,
**callback_kwargs)
File
"/home/andrey/work/redsolution/abvi/parts/django/django/contrib/admin/sites.py"
in root
  157.                 return self.model_page(request, *url.split('/', 2))
File
"/home/andrey/work/redsolution/abvi/parts/django/django/views/decorators/cache.p
y"
in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File
"/home/andrey/work/redsolution/abvi/parts/django/django/contrib/admin/sites.py"
in model_page
  176.         return admin_obj(request, rest_of_url)
File
"/home/andrey/work/buildouts/shared/eggs/django_page_cms-1.0.3-py2.4.egg/pages/a
dmin/__init__.py"
in __call__
  103.         ret = super(PageAdmin, self).__call__(request, url)
File
"/home/andrey/work/redsolution/abvi/parts/django/django/contrib/admin/options.py
"
in __call__
  197.             return self.change_view(request, unquote(url))
File
"/home/andrey/work/buildouts/shared/eggs/django_page_cms-1.0.3-py2.4.egg/pages/a
dmin/__init__.py"
in change_view
  324.                                                         extra_context)
File
"/home/andrey/work/redsolution/abvi/parts/django/django/db/transaction.py"
in _commit_on_success
  238.                 res = func(*args, **kw)
File
"/home/andrey/work/redsolution/abvi/parts/django/django/contrib/admin/options.py
"
in change_view
  564.         ModelForm = self.get_form(request, obj)
File
"/home/andrey/work/buildouts/shared/eggs/django_page_cms-1.0.3-py2.4.egg/pages/a
dmin/__init__.py"
in get_form
  282.             widget = self.get_widget(request, placeholder.widget)()
File
"/home/andrey/work/buildouts/shared/eggs/django_page_cms-1.0.3-py2.4.egg/pages/a
dmin/__init__.py"
in get_widget
  225.             module = __import__(module_name, {}, {}, [class_name])

Exception Type: TypeError at /admin/pages/page/3/
Exception Value: Item in ``from list'' not a string

The problem is that module_name and class_name variables are unicode
objects while __import__ expect them to be strings. I attach the patch to
fix that.

Original issue reported on code.google.com by andrey.f...@gmail.com on 22 May 2009 at 7:17

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by batiste....@gmail.com on 4 Jun 2009 at 12:43