0

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.

ephemeral
  • 429
  • 2
  • 7
  • 16
  • and why do you wanna do that? what is the problem now? – Exprator Jul 17 '17 at 15:53
  • Please don't ask the same question multiple times. If you haven't got an answer to your original question, you can update it to make it clearer. – Alasdair Jul 17 '17 at 15:53
  • @Exprator I cant get a value from view.py . So I have to assign values in view.py . Is it possible ? – ephemeral Jul 17 '17 at 15:59
  • @Alasdair there people are confusing . My question is just is it possible ? Or what is syntax to create dropdown in view.py ? – ephemeral Jul 17 '17 at 16:00
  • @ephemeral Please update your old question, rather than asking a new one here. I'm afraid I don't understand what you are asking, so I can't help. – Alasdair Jul 17 '17 at 16:05

0 Answers0