﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2554	[patch] Django has problems rendering FormFieldWrapper objects when they contain unicode	Victor Ng <victor.ng@…>	hugo	"Django throws exceptions when unicode data is rendered through a dropdown box.

Here's a stacktrace:

{{{
Traceback (most recent call last):
File ""/home/victorng/dev/django/trunk/django/core/handlers/base.py"" in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File ""/home/victorng/dev/django/trunk/django/db/transaction.py"" in _commit_manually
  218. return func(*args, **kw)
File ""/home/victorng/dev/django/trunk/django/views/decorators/cache.py"" in _cache_controlled
  25. response = viewfunc(request, *args, **kw)
File ""/home/victorng/dev/system/monkeybean/trunk/monkeybean/util/action_handler.py"" in __call__
  86. result = inst._generic_view(self._appName, self._shortModName, request, values)
File ""/home/victorng/dev/system/monkeybean/trunk/monkeybean/util/action_handler.py"" in _generic_view
  432. seed_data = self._http_get(request, values)
File ""/home/victorng/dev/system/monkeybean/trunk/monkeybean/util/action_handler.py"" in _http_get
  419. seed_data = self.get_seed_data(values, {})
File ""/home/victorng/dev/system/monkeybean/trunk/monkeybean/travel/views/agent.py"" in get_seed_data
  103. form = django.forms.FormWrapper(Agent.AddManipulator(), values, status_messages)
File ""/home/victorng/dev/django/trunk/django/db/models/manipulators.py"" in __init__
  69. self.fields.extend(f.get_manipulator_fields(self.opts, self, self.change))
File ""/home/victorng/dev/django/trunk/django/db/models/fields/__init__.py"" in get_manipulator_fields
  226. field_objs, params = self.prepare_field_objs_and_params(manipulator, name_prefix)
File ""/home/victorng/dev/django/trunk/django/db/models/fields/related.py"" in prepare_field_objs_and_params
  503. params['choices'] = self.get_choices_default()
File ""/home/victorng/dev/django/trunk/django/db/models/fields/__init__.py"" in get_choices_default
  302. return self.get_choices()
File ""/home/victorng/dev/django/trunk/django/db/models/fields/__init__.py"" in get_choices
  293. lst = [(getattr(x, self.rel.get_related_field().attname), str(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]

  UnicodeEncodeError at /travel/agent/
  'ascii' codec can't encode character u'\xc5' in position 0: ordinal not in range(128)
}}}

I'm attaching a patch that resolves this problem.  Still have to build a unit test for django."	defect	closed	Internationalization		major	duplicate			Unreviewed	1	0	0	0	0	0
