I posted this question with other caption but I want to ask that , I want to make a dropdown . And Query to get this values I have to assign in view.py. So can I assign this query in view.py to form field ?
like I have
class pdftabelModelForm(forms.ModelForm):
class Meta:
model = pdftabel_tool_
fields = ['apn', 'owner_name']
apn = forms.ModelChoiceField(queryset= Field.objects.values_list('name', flat=True), empty_label="(Choose field)")
owner_name = forms.ModelChoiceField(queryset= Field.objects.values_list('name', flat=True), empty_label="(Choose field)")
I want to do same in views.py and assign this form field. Any help would be highly appreciated.