[Answer]-Django Exclude ForeignKey field from ModelChoiceField

1👍

Why are you not using model form for drivers,

class DriverForm(forms.ModelForm):
    class Meta:
        model = Article
        fields = ['name', 'vehicle']

For your own forms,

class MyForm(forms.Form):
    driver_list = forms.ModelChoiceField(queryset=Driver.objects.order_by('name'))
    # then other attributes which you want to map with driver
👤Roshan

Leave a comment