[Answer]-Django: Help using ModelChoiceField

1👍

forms.py:

class MyForm(forms.Form):
    # or with some filter applied
    my_field = forms.ModelChoiceField(queryset=Equipment.objects.all()) 

Then just use {{ form.as_<whatever you want> }} in your template and it should work.

👤knbk

Leave a comment