How to make an input field with prompts that will appear in the process of entering data

I am making a site on Django. And I faced a problem. I would like to create an input field in the form so that it is initially empty, but so that in the process of how the user enters data into it, a frame will appear next to it, with possible selection options based on data already entered by the user.

In short, I want to make something like this field

enter image description here

Help me please

The Select2 library is one that does a lot of magic for you. enter image description here

An example from their own docs:

class AuthorWidget(s2forms.ModelSelect2Widget):
    search_fields = [

class BookForm(forms.ModelForm):
    class Meta:
        model = models.Book
        fields = "__all__"
        widgets = {
            "author": AuthorWidget,

urlpatterns = [
    path("select2/", include("django_select2.urls")),


<h1>Create a new Book</h1>
<form method="POST">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit">
<script src=""></script>
{{ }}

Back to Top