Skip to content

Commit ed30463

Browse files
committed
[soc2009/admin-ui] Omitting an extra comma at the end of the ID list for M2M autocomplete
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/admin-ui@11428 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent c4dd344 commit ed30463

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

django/contrib/admin/templates/widget/m2m_searchinput.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@
2525
'model_name': '{{ model_name }}'
2626
},
2727
multiple: true,
28-
mustMatch: true,
29-
autoFill: true
28+
mustMatch: true
3029
}).result(function(event, data, formatted) {
3130
if (data) {
32-
$('#id_{{ name }}').val($('#id_{{ name }}').val() + data[1] + ",");
31+
if ($('#id_{{ name }}').val()) {
32+
$('#id_{{ name }}').val($('#id_{{ name }}').val() + "," + data[1]);
33+
}
34+
else {
35+
$('#id_{{ name }}').val(data[1]);
36+
}
37+
3338
}
3439
});
3540
});

0 commit comments

Comments
 (0)