From 3bd384aa62608ca2aebdf6d86ae1a75abb96f4bf Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 11 Apr 2009 07:41:59 +0000 Subject: Fixed #10645 -- Added some robustness around some admin and modelform params. Fieldset dictionary names, search fields and unique_together attribute names all have to be convertible to strings (that has always been true). If somebody passes in a unicode object, Python barfs because Django uses those values as keyword argument names and function calls require parameter names to be str objects. We now convert thing to strs automatically. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10510 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/forms/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/forms') diff --git a/django/forms/models.py b/django/forms/models.py index 8d55e4459e..010d3bf61c 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -276,7 +276,7 @@ class BaseModelForm(BaseForm): # using it in a lookup. if isinstance(self.fields[field_name], ModelChoiceField): lookup_value = lookup_value.pk - lookup_kwargs[field_name] = lookup_value + lookup_kwargs[str(field_name)] = lookup_value qs = self.instance.__class__._default_manager.filter(**lookup_kwargs) -- cgit v1.3