Code

Ticket #8746: raw_id_field_more_tolerant.diff

File raw_id_field_more_tolerant.diff, 546 bytes (added by jfw, 5 years ago)
Line 
1Index: django/contrib/admin/widgets.py
2===================================================================
3--- django/contrib/admin/widgets.py     (revision 9845)
4+++ django/contrib/admin/widgets.py     (working copy)
5@@ -174,7 +174,7 @@
6     def value_from_datadict(self, data, files, name):
7         value = data.get(name, None)
8         if value and ',' in value:
9-            return data[name].split(',')
10+            return filter(None, [v.strip() for v in data[name].split(',')])
11         if value:
12             return [value]
13         return None