From f6a0b7cfe31367935cd124907b54fdd0b87ce261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Tue, 19 Oct 2010 07:14:38 +0000 Subject: [PATCH] Fixed #14407 -- Simplified ManyToManyRawIdWidget.value_from_datadict, Thanks tyrion! git-svn-id: http://code.djangoproject.com/svn/django/trunk@14283 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/widgets.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index 9f8b62041d..05b2566167 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -172,12 +172,9 @@ class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): return '' def value_from_datadict(self, data, files, name): - value = data.get(name, None) - if value and ',' in value: - return data[name].split(',') + value = data.get(name) if value: - return [value] - return None + return value.split(',') def _has_changed(self, initial, data): if initial is None: