1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

[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
This commit is contained in:
Zain Memon 2009-08-10 03:44:24 +00:00
parent c4dd344a9b
commit ed30463b6c

View File

@ -25,11 +25,16 @@ $(document).ready(function() {
'model_name': '{{ model_name }}' 'model_name': '{{ model_name }}'
}, },
multiple: true, multiple: true,
mustMatch: true, mustMatch: true
autoFill: true
}).result(function(event, data, formatted) { }).result(function(event, data, formatted) {
if (data) { if (data) {
$('#id_{{ name }}').val($('#id_{{ name }}').val() + data[1] + ","); if ($('#id_{{ name }}').val()) {
$('#id_{{ name }}').val($('#id_{{ name }}').val() + "," + data[1]);
}
else {
$('#id_{{ name }}').val(data[1]);
}
} }
}); });
}); });