Values from the second field of the form - depending on the selected value of the first field?

I have a Django form. In which there are two select fields from several values. The data from them is contained in the Django model database.

The first field of the form contains car brands.

In the second field of the form, I would like to display car models - depending on the car brand selected above.

How can I make the data appear in the second field of the form depending on the selected value of the first field?

class Model_for_form(models.Model):
    name_1 = models.CharField(max_length=150, verbose_name="Name_1")
    name_2 = models.CharField(max_length=150, verbose_name="Name_2")

    def __str__(self):
        return self.name_1, self.name_2

class Form_1(forms.ModelForm):

    class Meta:
        model = Model_for_form
        fields = "__all__"

def form_1(request):
    context = {}
    form = Model_for_form(request.POST or None)
    if form.is_valid():
        form.save()
        return redirect("form_0")
    context['form_1'] = form
    return render(request, "form_1.html", context)

{% extends "base.html" %}
{% block content %}
    <hr/>
    <div class="row">
        <div class="col-6">
            <form method="POST" class="post-form">
                {% csrf_token %} {{form_1.as_p}}
                <button type="submit" class="save btn btn-light">button</button>
            </form>
        </div>
    </div>
    <br/>

What you’re looking for is commonly referred to as “chained” or “cascade” select widgets.

There are many conversations in this forum about this topic. Two of the more recent that may be of value are:

If you’re looking for a pre-packaged solution, Select2 (and its corresponding Django package Django-Select2) are probably what are referenced most often here. (We’re starting to use HTMX in a new project for this - it’s another viable option.)

If you check out djangopackages.org and search for “select”, you’ll see some other options.