Django: select2 doesn't pre-fill selected fields when form is invalid

I have a form, and in the form I have select2 fields. When I search/select something - it’s selected, it’s ok. But if I send my form and the form is invalid - in request.POST data I have data for selected fields, but in front I have nothing selected, the fields become empty. If the form is valid - data sends correctly and saves correctly too. How not lose the entered data? In my select2 I have this ajax:

    ajax: {
        url: searchCityUrl,
        dataType: 'json',
        cache: true,
        data: function (params) {
            return {
                q: params.term
            };
        },
        processResults: function (data) {
            return {
                results: $.map(data.data, function (item) {
                    return {
                        text: item.name,
                        id: item.id
                    }
                })
            }
        },
    },