[Answered ]-Running into issues with Django's ModelChoiceField "queryset" attribute

2👍

Assuming your field take a Car queryset, you can construct one like the following:

mylist = ['BMW', 'Lamborghini', 'Porsche']
cars = Car.objects.filter(name__in=mylist)
self.fields['possible_cars'].queryset = cars

Leave a comment