Is it possible to filter form field according to another field?

I want to choose only a car_model related to the selected vehicle_brand. Is it possible to do in django? Or need to use JS?

Code example below:

vehicle_brand = forms.ModelChoiceField(label='Brand', queryset=VehicleBrand.objects.all(),
                                           widget=forms.Select(attrs={'class': 'select form-select'}))
car_model = forms.ModelChoiceField(label='Model', queryset=CarModel.objects.all(),
                                       widget=forms.Select(attrs={'class': 'select form-select'}))
Back to Top