Opened 3 years ago

Closed 3 years ago

#32823 closed New feature (duplicate)

Cannot pass extra AJAX settings to admin autocomplete

Reported by: Seb G Owned by: nobody
Component: contrib.admin Version: 3.2
Severity: Normal Keywords: autocomplete
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This ticket is partly linked to #32628 where the bug was reported along with a feature request and got ignored.


The provided JS function $.fn.djangoAdminSelect2(options) allows user to provide extra options that will be passed to select2. But passing extra AJAX options does not work as it rewrites the whole ajax option object instead of extending it.

Example failing call:

$(#my-select).djangoAdminSelect2({
    ajax: {
        processResults: function (data) {
            console.log("Foo")
            return data
        }
    }
});

This call fails because passing an ajax object to $.fn.djangoAdminSelect2 erases the whole default ajax object including the required ajax.data default option.

This failure is caused by the non-recursive call to $.extend and can be easily resolved by adding the recursive parameter to it.

I am available to PR this one quickly if accepted.

Change History (1)

in reply to:  description comment:1 by Mariusz Felisiak, 3 years ago

Resolution: duplicate
Status: newclosed
Type: BugNew feature

Replying to Seb G:

This ticket is partly linked to #32628 where the bug was reported along with a feature request and got ignored.

Not ignored but rejected. Again, please don't reopen closed tickets or create duplicates. You can start a discussion on DevelopersMailingList if you don't agree, see triaging guidelines with regards to wontfix tickets.

Duplicate of #32628.

Note: See TracTickets for help on using tickets.
Back to Top