diff --git a/apps/member/views.py b/apps/member/views.py index a41b0bff..2bc2133c 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -266,11 +266,10 @@ class ProfileTrustView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): )) context["widget"] = { "name": "trusted", + "resetable": True, "attrs": { - "model_pk": ContentType.objects.get_for_model(Alias).pk, "class": "autocomplete form-control", "id": "trusted", - "resetable": True, "api_url": "/api/note/alias/?note__polymorphic_ctype__model=noteuser", "name_field": "name", "placeholder": "" diff --git a/note_kfet/static/js/autocomplete_model.js b/note_kfet/static/js/autocomplete_model.js index 2a2677d4..a8b2461c 100644 --- a/note_kfet/static/js/autocomplete_model.js +++ b/note_kfet/static/js/autocomplete_model.js @@ -1,3 +1,5 @@ +const keycodes = [32, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 106, 107, 109, 110, 111, 186, 187, 188, 189, 190, 191, 219, 220, 221, 222] + $(document).ready(function () { $('.autocomplete').keyup(function (e) { const target = $('#' + e.target.id) @@ -10,7 +12,6 @@ $(document).ready(function () { const input = target.val() target.addClass('is-invalid') target.removeClass('is-valid') - $('#' + prefix + '_reset').removeClass('d-none') $.getJSON(api_url + (api_url.includes('?') ? '&' : '?') + 'format=json&search=^' + input + api_url_suffix, function (objects) { let html = '